Answer the question
In order to leave comments, you need to log in
How can I get latitude and longitude from UserLocationView / user location?
I need to show in the application the current location of the user and the places around him. What do I need to get the user's LatLong (in Double)
@Override
public void onObjectAdded(@NonNull UserLocationView userLocationView) {
Double lat, lng;
float width = (float) (mapView.getWidth() * 0.5);
float height = (float) (mapView.getHeight() * 0.5);
userLocationLayer.setAnchor(new PointF(width, height), new PointF(width, height));
CompositeIcon pinIcon = userLocationView.getPin().useCompositeIcon();
pinIcon.setIcon("pin", ImageProvider.fromResource(this, R.drawable.img_map_pointer_user),
new IconStyle().setAnchor(new PointF(0.5f, 0.5f))
.setRotationType(RotationType.NO_ROTATION)
.setScale(5f));
userLocationView.getAccuracyCircle().setFillColor(getColors(R.color.colorAccent));
lat =.....
lng = .....
initCall(lat, lng);
}
LatLng latLng = new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude());
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question