I use google place api webservice in my android app and I'm new in android and can't to read the JSON
result from api , I print this result
{
"location": {
"lng": -73.9834889,
"lat": 40.7724641
}
}
and
{
"viewport": {
"southwest": {
"lng": -74.03514899999999,
"lat": 40.698078
},
"northeast": {
"lng": -73.90331300000001,
"lat": 40.820045
}
},
"location": {
"lng": -73.9712488,
"lat": 40.7830603
}
}
when I write this code
JSONObject dataObj = new JSONObject(response);
String status = dataObj.getString("status");
Log.i("status",status);
if (status.equals("OK")) {
JSONObject jsonArray =dataObj.getJSONObject("results");
Log.i("result",""+jsonArray);
JSONArray aa=dataObj.getJSONArray("results");
Log.i("resultssss",""+aa);
ArrayList<Mosque> mosque = new ArrayList<Mosque>();
for (int i = 0; i < aa.length(); i++) {
JSONObject jsonObject = aa.getJSONObject(i);
String geometry=jsonObject.getString("geometry");
Log.i("geometry",geometry);