From 50d579d0ec9c9d0bcd3da936af8480808d5e0843 Mon Sep 17 00:00:00 2001 From: Vairavan Srinivasan Date: Tue, 7 Sep 2010 19:13:46 -0700 Subject: [PATCH] GlobalTime: Perform Zoom In and Out only after initialization Invoking zoom on mGLView before initialization causes Null pointer exception. The usecase is to launch global time and immediately press key 2 or 8 (just before the globe is seen on display). Change-Id: I10e7736527a934029364c9c83f147f94574f5488 --- samples/GlobalTime/src/com/android/globaltime/GlobalTime.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/GlobalTime/src/com/android/globaltime/GlobalTime.java b/samples/GlobalTime/src/com/android/globaltime/GlobalTime.java index d96b644a9..e27ee56e5 100644 --- a/samples/GlobalTime/src/com/android/globaltime/GlobalTime.java +++ b/samples/GlobalTime/src/com/android/globaltime/GlobalTime.java @@ -898,7 +898,7 @@ class GTView extends SurfaceView implements SurfaceHolder.Callback { // The '2' key zooms out case KeyEvent.KEYCODE_2: - if (!mAlphaKeySet && !mDisplayWorldFlat) { + if (!mAlphaKeySet && !mDisplayWorldFlat && mInitialized) { mGLView.zoom(-2); handled = true; } @@ -906,7 +906,7 @@ class GTView extends SurfaceView implements SurfaceHolder.Callback { // The '8' key zooms in case KeyEvent.KEYCODE_8: - if (!mAlphaKeySet && !mDisplayWorldFlat) { + if (!mAlphaKeySet && !mDisplayWorldFlat && mInitialized) { mGLView.zoom(2); handled = true; }