I download the information from the url in json and full variables
private static PostResponseAsyncTask task;
OnCreate
task = new PostResponseAsyncTask(this);
task.execute(url_localizacion+Dispositivo);
I run the task in the url + methodGET
@Override
public void processFinish(String s) {
try {
JSONArray jsonArray = new JSONArray(s);
for (int i = 0; i < jsonArray.length(); i++) {
Longitud = (jsonArray.getJSONObject(i).getString("longitud"));
Latitud = (jsonArray.getJSONObject(i).getString("latitud"));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
Here my question is getting the Latitude and Longitude of the database data in the cloud but I am running the google map before.
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
// Add a marker in Sydney and move the camera
LatLng locMovil = new LatLng(parseDouble(Latitud),parseDouble(Longitud));
mMap.addMarker(new MarkerOptions().position(locMovil).title(Dispositivo)); //Titulo de Marker
//mMap.moveCamera(CameraUpdateFactory.newLatLng(locMovil));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(locMovil, (float) 16.0));
}
How can I first download the information from the cloud and then add the coordinates of the variables Longitud y Latitud
?