java - TabHost in FragmentActivity and screen rotation -


i don't understand how use retain instance on screen rotation while using tabhost inside fragmentactivity. found lot of things that, either talking use onretainnonconfigurationinstance() deprecated. or tu use setretaininstance(boolean) fragmentactivity doesn't have method. fragment have it.

on link can find out code of main activity: http://code.google.com/p/musclehackandroid/source/browse/src/com/musclehack/musclehack/mainactivity.java

thanks in advance,

cédric

you can use onsavedinstancestate save current selected tab:

@override protected void onsaveinstancestate(bundle outstate) {     outstate.putint("tab_position", host.getcurrenttab());     super.onsaveinstancestate(outstate); } 

afterwards can retrain selected position in oncreate:

if (savedinstancestate != null) {     host.setcurrenttab(savedinstancestate.getint("tab_position")); } 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -