Onconfigurationchanged Problems
Solution 1:
Try using android:configChanges="orientation|keyboardHidden|screenSize"
Caution: Beginning with Android 3.2 (API level 13), the "screen size" also changes when the device switches between portrait and landscape orientation. Thus, if you want to prevent runtime restarts due to orientation change when developing for API level 13 or higher (as declared by the minSdkVersion and targetSdkVersion attributes), you must include the "screenSize" value in addition to the "orientation" value. That is, you must decalare android:configChanges="orientation|screenSize". However, if your application targets API level 12 or lower, then your activity always handles this configuration change itself (this configuration change does not restart your activity, even when running on an Android 3.2 or higher device).
Source : Documentation
Hence, also add "|screenSize" to configChanges
if your application targets API 13 and above.
Solution 2:
Lets say your portrait orientation layout file is in layout/my_layout.xml
Place the layout you want to be used in the landscape mode in layout-land folder with the same layout file name. i.e. layout-land/my_layout.xml
Do not add android:configChanges="orientation" to the the manifest for that activity.
You do not need to explicitly change the layout. You do not need to override the onConfigurationChanged(Configuration newConfig) function
Solution 3:
try this one....
android:configChanges="orientation|keyboardHidden|screenSize"
Post a Comment for "Onconfigurationchanged Problems"