mapbox default method lifcycle

This commit is contained in:
Domagalski 2018-09-30 12:15:26 +02:00
parent 64c594174a
commit 89ef83033b

View File

@ -6,6 +6,8 @@ import android.view.View;
import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
import com.uam.wmi.findmytutor.R; import com.uam.wmi.findmytutor.R;
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext; import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
@ -21,43 +23,54 @@ public class MapActivity extends BaseActivity {
Mapbox.getInstance(this, getString(R.string.access_token)); Mapbox.getInstance(this, getString(R.string.access_token));
mapView = findViewById(R.id.mapView); mapView = findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState); mapView.onCreate(savedInstanceState);
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(MapboxMap mapboxMap) {
// Customize map with markers, polylines, etc.
}
});
} }
@Override
public void onStart()
{
super.onStart();
mapView.onStart();
Log.d(tag, "In the onStart() event");
}
@Override
public void onRestart()
{
super.onRestart();
Log.d(tag, "In the onRestart() event");
}
@Override
public void onResume() // Add the mapView lifecycle to the activity's lifecycle methods
{ @Override
public void onResume() {
super.onResume(); super.onResume();
mapView.onResume(); mapView.onResume();
Log.d(tag, "In the onResume() event");
} }
@Override @Override
public void onPause() protected void onStart() {
{ super.onStart();
super.onPause(); mapView.onStart();
mapView.onPause();
Log.d(tag, "In the onPause() event");
} }
@Override @Override
public void onStop() protected void onStop() {
{
super.onStop(); super.onStop();
mapView.onStop(); mapView.onStop();
Log.d(tag, "In the onStop() event"); }
@Override
public void onPause() {
super.onPause();
mapView.onPause();
}
@Override
public void onLowMemory() {
super.onLowMemory();
mapView.onLowMemory();
}
@Override
protected void onDestroy() {
super.onDestroy();
mapView.onDestroy();
} }
@Override @Override