I am looking for a way to add my own lat/long markers on the map for my android app. I tried looking up the places api documentation, but really couldn't wrap my mind around how it should look like. The idea is to be able to feed the app a lat/long tuple, save it in a database and then allow other users to get a hold of this information in the form of a marker on their MapView. Thanks in advance
You can use Location Manager to fetch current latitude and longitude.
double lat = location.getLatitude();
double long = location.getLongitude();
Latlang start = new LatLng(lat, long);
Then add marker as:
MarkerOptions options = new MarkerOptions();
options.position(start);
options.icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_start_blue));
mMap.addMarker(options);
Then animate the camera at that point.
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.