It has been a long time since this question was active, but I still have to answer it. I had the same problem and found the answer.
In the manifest, you must add to your activity android:configChanges=orientation|screenLayout|layoutDirection|screenSize, which should not trigger default actions when you change the orientation.
...
<activity android:name=".Activity"
android:screenOrientation="portrait"
android:configChanges="orientation|screenLayout|layoutDirection|screenSize"
...
And in your activity:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
Original example:
http://android-er.blogspot.fi/2011/05/prevent-activity-restart-when-screen.html
source
share