I realize that there are a couple other posts on this topic, however the solutions for those posts are not working for me.
Basically, I want to cease my Activity from restarting upon a device orientation change. To do this, I have modified the activity in the manifest file:
<activity android:name=".MyActivity" android:configChanges="orientation|keyboardHidden"></activity>
and I have overridden onConfigurationChanged() in my Activity:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
System.out.println("IN onConfigurationChanged()");
}
However, the activity is still restarting upon an orientation change, and the onConfigurationChanged() method is not being called.
Does anyone know why this may be happening?
The only thing that worked was using getLastNonConfigurationInstance(). http://developer.android.com/reference/android/app/Activity.html#getLastNonConfigurationInstance()