android - How can I prevent the current tab view from being lost when rotating the screen? -


i have tabhost 4 tabs. if (for example) open tab #3, start simple alert dialog, , rotate phone few times, loses focus on tab open before, when press back, tab #1 shows instead of tab #3.

i very grateful solution or hints solve problem.

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();     } 

did try save state of tabhost? if not - check reto meier answer in this discussion.

you can save current position of tabhost using getcurrenttab @ onsaveinstancestate, , restore @ onrestoreinstancestate using setcurrenttab.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -