[android] fix map in dialog activity
This commit is contained in:
committed by
Ivo van Dongen
parent
c6cafc5e10
commit
04d7aced4d
@@ -1,6 +1,8 @@
|
||||
package com.mapbox.mapboxsdk.testapp.activity.maplayout;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
@@ -65,6 +67,22 @@ public class MapInDialogActivity extends AppCompatActivity {
|
||||
mapView.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
return new Dialog(getActivity(), getTheme()) {
|
||||
boolean destroyed = false;
|
||||
@Override
|
||||
public void dismiss() {
|
||||
if (mapView != null && !destroyed) {
|
||||
mapView.onDestroy();
|
||||
destroyed = true;
|
||||
}
|
||||
super.dismiss();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
@@ -89,12 +107,6 @@ public class MapInDialogActivity extends AppCompatActivity {
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
mapView.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
|
||||
Reference in New Issue
Block a user