I\'m trying to return the location selected by the user in the Google Maps Android application, but I can\'t seem to find information about how to achieve this task.
I guess you are looking for markers dragging.
mMap.setMyLocationEnabled(true);
mLocation = mMap.getMyLocation();
mMap.addMarker(new MarkerOptions().position(new LatLng(mLocation.getLatitude(), mLocation.getLongitude())).draggable(true));
mMap.setOnMarkerDragListener(new OnMarkerDragListener() {
@Override
public void onMarkerDrag(Marker marker) {
}
@Override
public void onMarkerDragEnd(Marker marker) {
LatLng newLocation = marker.getPosition();
mLocation.setLatitude(newLocation.latitude);
mLocation.setLongitude(newLocation.longitude);
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(mLocation.getLatitude(), mLocation.getLongitude()), 15.0f));
}
@Override
public void onMarkerDragStart(Marker marker) {}
});
then return your new location.i.e mLocation.