Reputation: 193
I am developing an Android application with a TabHost in it SDK 7.
My problem is the screen orientation changing handler fails to do the job. This is the scenario:
What I mean by “fail” to update the screen is:
This is the method that I used:
android:configChanges="keyboardHidden|orientation"
in every sceen (both TabActivity and each child of it)onConfigurationChanged()
in every child screen Any suggestion or a workaround for my problem? I will appreciate and try every suggestion. Thank you :D
Upvotes: 1
Views: 344
Reputation: 134714
Your solution should be to handle configuration changes properly. Using configChanges is only an optimization for very edge case situations, but you still need to be prepared for the case when your Activity state is saved and your Activity destroyed to relieve memory pressure.
In your Activity:
@Override
public void onSaveInstanceState(Bundle outState) {
// Put any temporary state for this Activity instance
// into the outState bundle
}
Then in onCreate():
@Override
public void onCreate(Bundle savedInstanceState) {
if (savedInstanceState != null) {
// Retrieve and reassign any state that you saved
}
}
Also see Handling Runtime Changes
Upvotes: 0