0
Wie ich MAPBOX in meiner Anwendung verwende.Ich weiß nicht, wie man aktuelle Lat und Long.Ich habe diesen Weg, um den aktuellen Standort zu bekommen.Aber es zeigt Null Objektreferenz .please mir helfen, mein ProblemWie bekomme ich den aktuellen Standort in MAPBOX in android
mapView = (MapView)view. findViewById(R.id.mapView);
mapView.setStyleUrl(Style.MAPBOX_STREETS);
mapView.onCreate(savedInstanceState);
//Add a mapBoxMap
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
mapboxMap.setMyLocationEnabled(true);
// Set the origin waypoint to the devices location
Position origin = Position.fromCoordinates(mapboxMap.getMyLocation().getLongitude(), mapboxMap.getMyLocation().getLatitude());
Log.i("RR","mapboxMap.getMyLocation();"+origin);
// Log.i("RR","mapboxMap.getMyLocation();"+mapboxMap.getMyLocation().getLongitude());
mapboxMap.getUiSettings().setZoomControlsEnabled(true);
mapboxMap.getUiSettings().setZoomGesturesEnabled(true);
mapboxMap.getUiSettings().setScrollGesturesEnabled(true);
mapboxMap.getUiSettings().setAllGesturesEnabled(true);
}
});