I'm still NEW, i repeat, NEW in android studio and I'm trying to display place name,vicinity,lat and long using listview. I already got listview ready but I couldnt get the string from the OnPostExecute. I tried using this https://stackoverflow.com/a/12575319/5776859 but It did not work at all, or maybe I didnt do it correctly. I hope anyone could help me or show me the proper way to get the string and double from the OnPostExecute.
public class PlacesDisplayTask extends AsyncTask<Object, Integer,
List<HashMap<String,String>>> {
JSONObject googlePlacesJson;
GoogleMap googleMap;
@Override
public List<HashMap<String, String>> doInBackground(Object... inputObj) {
List<HashMap<String, String>> googlePlacesList = null;
Places placeJsonParser = new Places();
try {
googleMap = (GoogleMap) inputObj[0];
googlePlacesJson = new JSONObject((String) inputObj[1]);
googlePlacesList = placeJsonParser.parse(googlePlacesJson);
} catch (Exception e) {
Log.d("Exception", e.toString());
}
return googlePlacesList;
}
@Override
protected void onPostExecute(List<HashMap<String,String>> list) {
for (int i = 0; i < 3; i++) {
HashMap<String, String> googlePlace = list.get(i);
double lat = Double.parseDouble(googlePlace.get("lat"));
double lng = Double.parseDouble(googlePlace.get("lng"));
String placeName = googlePlace.get("place_name");
String vicinity = googlePlace.get("vicinity");
}
}
}