Problems When Handling Orientation Changes
Solution 1:
This is a documented bug in the emulator ONLY. A real device will not exhibit this double-lifecycle-events behavior. I had the same issue a while ago and it disappears on a real device.
I would suggest ignoring the problem if you can by only testing orientation changes in one direction until you get your hands on a physical phone. Otherwise you might be able to "skip" the second set of lifecycle calls by keeping a static boolean around indicating you've already gone through the first set.
See this issue report for more info.
Solution 2:
Have you tried using onConfigurationChanged?
@OverridepublicvoidonConfigurationChanged(Configuration newConfig) {
if(newConfig.equals(Configuration.ORIENTATION_LANDSCAPE)…
Solution 3:
Add android:configChanges="orientation" in manifest file in activity tag like
<activity android:label="@string/app_name"
android:configChanges="orientation"
android:name=".com.androidpeople">
Post a Comment for "Problems When Handling Orientation Changes"