Answer the question
In order to leave comments, you need to log in
How, when reading a json file from index.php, how to create an array of strings that will be used in another class?
Here is the code to create an array. How to use in another class? When using heteros and seters: in another class, it says that it is necessary to make the nested class static. How to be? Tell me please
try {
JSONObject jsonObj = new JSONObject(jsonStr);
// Getting JSON Array node
JSONArray items = jsonObj.getJSONArray("items");
// looping through All Contacts
for (int i = 0; i < items.length(); i++) {
JSONObject c = items.getJSONObject(i);
String latitude = c.getString("latitude");
String longitude = c.getString("longitude");
String[] coo = new String[items.length()];
coo[i] = "" + latitude + "," + longitude + "";
}
} catch (final JSONException e) {
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question