Skip to content Skip to sidebar Skip to footer

How Can I Prevent The Current Tab View From Being Lost When Rotating The Screen?

I have tabhost with 4 tabs. If I (for example) open tab #3, start a simple alert dialog, and then rotate the phone a few times, it loses focus on which tab was open before, so when

Solution 1:

Did you try save state of TabHost? If not - check Reto Meier answer in this discussion.

You can save current position of TabHost using getCurrentTab at onSaveInstanceState, and restore it at onRestoreInstanceState using setCurrentTab.

Post a Comment for "How Can I Prevent The Current Tab View From Being Lost When Rotating The Screen?"