简体   繁体   中英

Display a location on Google Maps in Android Activity

I'm working on an Android project in which I will need to display the locations of various airports on Google Maps. I already have a list of latitude/longitude coordinates. My question is:

How do I get these coordinates to Display as a location in Google Maps on an Android Activity? What classes or other methods should I consider? Are there any templates or tutorials I could look at? Any help is most appreciated.

If you already have lat/lng for all required places, you can just use this in a loop for all coordinates:

  LatLng loc = new LatLng(latitude,longitude);
  map.addMarker(new MarkerOptions().position(loc).title("locationName"));

I think you need to use markers on your mapView

Here you can find the official documentation of the google map api, you'll find it's very easy to add marker on the map.

If you also need to use the current location, I suggest you to read This too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM