summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
index 256f49ef52..0534f6cf69 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
@@ -72,6 +72,7 @@ public class MapView extends FrameLayout {
private NativeMapView nativeMapView;
private MapboxMapOptions mapboxMapOptions;
private boolean destroyed;
+ private boolean hasSurface;
private MyLocationView myLocationView;
private CompassView compassView;
@@ -318,6 +319,7 @@ public class MapView extends FrameLayout {
}
private void initRenderSurface() {
+ hasSurface = true;
post(new Runnable() {
@Override
public void run() {
@@ -406,7 +408,7 @@ public class MapView extends FrameLayout {
destroyed = true;
mapCallback.clearOnMapReadyCallbacks();
- if (nativeMapView != null) {
+ if (nativeMapView != null && hasSurface) {
// null when destroying an activity programmatically mapbox-navigation-android/issues/503
nativeMapView.destroy();
nativeMapView = null;