From b63863af4481996d696e0898ca90a651f660dc1a Mon Sep 17 00:00:00 2001 From: Steve Slaven Date: Mon, 10 Jan 2011 15:15:49 -0800 Subject: Don't intialize the orientation listener until we've finished setting up our views to eliminate force close race condition diff --git a/AndroidManifest.xml b/AndroidManifest.xml index ca21b46..c833456 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="18" + android:versionName="3.04"> diff --git a/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java b/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java index fa23127..9371814 100644 --- a/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java +++ b/src/net/hoopajoo/android/SoftKeys/SoftKeysService.java @@ -262,14 +262,6 @@ public class SoftKeysService extends Service { // The main buttons mView = l.inflate( R.layout.service, null ); - - mOrientationListener = new OrientationEventListener( this, SensorManager.SENSOR_DELAY_NORMAL ) { - @Override - public void onOrientationChanged( int orientation ) { - initOrientation(); - } - }; - mOrientationListener.enable(); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences( this ); @@ -472,6 +464,14 @@ public class SoftKeysService extends Service { wm.addView( mView, makeOverlayParams() ); wm.addView( mExtraView, makeOverlayParams() ); + mOrientationListener = new OrientationEventListener( this, SensorManager.SENSOR_DELAY_NORMAL ) { + @Override + public void onOrientationChanged( int orientation ) { + initOrientation(); + } + }; + mOrientationListener.enable(); + initOrientation(); } -- cgit v0.10.2