How to make a request to display markers on your android device (on google maps). I connect to json, but nothing happens. Tell me how it is done.
Update
Here is the link to json, I need to display the markers in the application.
How to make a request to display markers on your android device (on google maps). I connect to json, but nothing happens. Tell me how it is done.
Update
Here is the link to json, I need to display the markers in the application.
You can add a marker like this:
map.addMarker(new MarkerOptions() .position(new LatLng(10, 10)) .title("Hello world")); You need to extract the coordinates from the server and add it to the map:
private void fun(GoogleMap map, String response) throws JSONException { JSONObject object = new JSONObject(response); JSONArray arr = object.getJSONArray("markers"); for (int i=0; i<arr.length(); i++) { JSONObject item = arr.get(i); map.addMarker(new MarkerOptions() .position(new LatLng(item.get("lat"), item.get("lng"))) .title("Hello world")); } } Source: https://ru.stackoverflow.com/questions/535670/
All Articles