How can I prevent the current tab view from being lost when rotating the screen?
<p>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 I press back, tab #1 shows up instead of tab #3.</p>

<p>I would be <strong>very</strong> grateful for a solution or any hints to solve this problem.</p>

<pre><code>protected void onSaveInstanceState(Bundle outState) {   
        super.onSaveInstanceState(outState);
        saveState();
    }
    protected void onPause() {
        super.onPause();
        saveState();
    }
    protected void onResume() {
        super.onResume();
        getTabHost().setCurrentTab(currentTab);
    }   
    private void saveState(){
        currentTab=getTabHost().getCurrentTab();
    }
</code></pre>
