i want to show location with multiple markers on google maps android, the problem is when i run my apps, it just show one location/marker, this is my code :
public class koordinatTask extends AsyncTask<String, String, String>
{
@Override
protected void onPreExecute() {
super.onPreExecute();
setProgressBarIndeterminateVisibility(true);
}
protected String doInBackground(String... args) {
String url = "http://absc?action=p04&prov="+link_kode+"&tipe=";
JSONArray data = null;
try {
JSONParser jParser = new JSONParser();
JSONObject json = jParser.getJSONFromUrl(url);
// Getting Array of data
data = json.getJSONArray(real_data);
System.out.println("realisasi done");
for(int i = 0; i < data.length(); i++){
JSONObject c = data.getJSONObject(i);
HashMap<String, String> map = new HashMap<String, String>();
HashMap<String, Double> map1 = new HashMap<String, Double>();
x_lat = c.getDouble(x_cord);
y_long = c.getDouble(y_cord);
label = c.getString(prov_label);
map1.put(x_cord, x_lat);
map1.put(y_cord, y_long);
map.put(prov_label, label);
ProvinsiList.add(map);
ProvinsiList.add(map1);
System.out.println(x_lat);
}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(String file_url) {
LatLng MAP_PUPI = new LatLng(x_lat, y_long);
Marker Pupi = map.addMarker(new MarkerOptions().position(
new LatLng(x_lat, y_long)).title(label));
map.moveCamera(CameraUpdateFactory.newLatLngZoom(MAP_PUPI, 15));
map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
}
}
i don't know where's my fault, i hope somebody can help me to solve my problem, thank u verymuch