android – markers from local database


How to correctly make a request to display markers on an android device (on google maps). I am connecting to json but nothing happens. Tell me how it's done.


Here is the json link , I need to output the markers in the app.


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 response from the server and add 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"));
Scroll to Top