My project runs and it show already current location of device. My question is there is a JSON
that include 4 address. I should add these addresses on the map. How can add these locations to map from JSON
?
Website of this JSON: https://instalyticsdbplandiag814.blob.core.windows.net/mobiversite/location.json
Try this snippet:
try {
JSONObject jsonObject= new JSONObject(jsonAsString);
JSONArray jsonArray=jsonObject.getJSONArray("locations");
for(int i=0;i<jsonArray.length(); i++){
JSONObject item = jsonArray.getJSONObject(i);
String name=item.getString("name");
String lattitude= item.getString("lattitude");
String longitude= item.getString("longitude");
//process as you want
}
} catch (JSONException e) {
e.printStackTrace();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.