Problem: my remote server returns 10 values for the request. I analyzed my answer and used the added markers for the loop (here I added information to the header and fragment) on the map (here I want to add additional data to the marker so that I can access it in the event event of the info window)
in infoWindowClickListener I want to access this additional data.
How to add additional data to a marker / how to access ph-data for a specific click of a marker (otherwise I get the last ph value in all markers).
I tried like this.
private class HttpGetTask extends AsyncTask<Void, Void, String>
{
}
@Override
protected void onPostExecute(String result) {
try {
json = new JSONArray(result);
for (int i = 0; i < json.length(); i++) {
Log.v("Response", result);
final JSONObject e = json.getJSONObject(i);
String point = e.getString("point");
Log.v("POINT", point);
String phone1 = e.getString("ph");
Log.v("PH", phone1);
String[] point2 = point.split(",");
double lat1 = Double.parseDouble(point2[0]);
double lng1 = Double.parseDouble(point2[1]);
Log.v("LLDN", "" + lat1 + "&" + lng1);
gMap.addMarker(new MarkerOptions()
.title(e.getString("name"))
.snippet(
e.getString("LS")+""+e.getString("ph") )
.position(new LatLng(lng1, lat1))
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.pmr)));
}
} catch (JSONException e)
{
e.printStackTrace();
}
Is it possible to add an additional value to the marker along with the title and fragment.? or am I misunderstood.?