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.

  • Do you need to put markers on the map? - Android Android
  • @AndroidAndroid precisely, only geodata from local database - wew
  • Request where and for what? Why should something happen when you connect to something? Telepaths on vacation so you have to ask a question in more detail to help you. - xkor
  • one
    Ok, what are you doing to realize what you need, and what exactly is failing? This site does not write custom-made implementations of applications or their components, here they help to solve problems arising while writing them. - xkor
  • one
    If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky

1 answer 1

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")); } }