Quantcast
Channel: Android Mode - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 941

ANdroid+Json, how i can access json api's in android mode?

$
0
0

i have 1 error in this line when i try to build for android mode

json = loadJSONObject("http://api.openweathermap.org/data/2.5/weather?q=London&appid=2de143494c0b295cca9337e1e96b00e0");

Errors

The method loadJSONObject(String) is undefined for the type filename1

Error from inside the android tools

i check internet in the tab sketch permissions but i cant build ...is there a solution for loadJSONObject in android mode or another method to access json api's?

i saw this forum with another example[https://forum.processing.org/two/discussion/2294/processing-android-json-file](https://forum.processing.org/two/discussion/2294/processing-android-json-file) but it doesn't work for me ,it builds but doesn't work on my device ,and i have internet permission for this example

String url = "http://api.openweathermap.org/data/2.5/weather?q=London&appid=2de143494c0b295cca9337e1e96b00e0" ;
 int instanceID;
void setup() {
  size(200, 400);
  background(0);
  String[] homePage = loadStrings(url);
  String jsonFragment = homePage[0];
  JSONObject json = JSONObject.parse(jsonFragment);
  instanceID = json.getInt("id");
  println(instanceID);
}
void draw() {
  text(instanceID,23,23);
}

give me suggestions ,please, i have android device 4.4.2


Viewing all articles
Browse latest Browse all 941

Trending Articles