From a65c19c5694a54770eddf03536ff8dcb585608b1 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Wed, 13 Apr 2016 19:53:01 +0300 Subject: [PATCH] [android] Only render after the surface is created --- .../main/java/com/mapbox/mapboxsdk/maps/MapView.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 963ae8d75..818c33676 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 @@ -118,6 +118,8 @@ public class MapView extends FrameLayout { private int mAverageIconWidth; private NativeMapView mNativeMapView; + private boolean mHasSurface = false; + private CompassView mCompassView; private ImageView mLogoView; private ImageView mAttributionsView; @@ -1243,6 +1245,10 @@ public class MapView extends FrameLayout { return; } + if (!mHasSurface) { + return; + } + mNativeMapView.render(); } @@ -1276,12 +1282,16 @@ public class MapView extends FrameLayout { public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { mNativeMapView.createSurface(mSurface = new Surface(surface)); mNativeMapView.resizeFramebuffer(width, height); + + mHasSurface = true; } // Called when the native surface texture has been destroyed // Must do all EGL/GL ES destruction here @Override public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { + mHasSurface = false; + if (mNativeMapView != null) { mNativeMapView.destroySurface(); }