KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have one Activity with multiple Fragments. I am also using actionbarSherlock for my tabs which also connected to fragments. My Problem is when I am going to rotate the screen (that is portrait to landscape/vice-versa), my activity will be called again so it restarts my activity. I want not to restart my activity but just restore the current fragment that was shown before it was rotate. PLEASE don't answer android:configChanges="orientation|keyboardHidden" since it does not solved the issue but just like a simple hack of it. My solution was the OnsaveInstanceState and onRestoreInstanceState Methods but I just don't know how to use it with my problem. Please help me with this one. Any response are highly much appreciated. CODE: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ActionBar.Tab tabA = actionBar.newTab().setIcon(R.drawable.about); ActionBar.Tab tabE = actionBar.newTab().setIcon(R.drawable.faq); ActionBar.Tab tabB = actionBar.newTab().setIcon(R.drawable.sponsors); ActionBar.Tab tabC = actionBar.newTab().setIcon(R.drawable.map); ActionBar.Tab tabD = actionBar.newTab().setIcon(R.drawable.destination); Fragment aboutTab = new PhotosActivity(); Fragment sponsorTab = new SongsActivity(); Fragment mapTab = new HCCMapActivity(); Fragment questTab = new FaqActivity(); Fragment DestinationTab = new TourActivity(); tabA.setTabListener(new MyTabsListener(aboutTab)); tabB.setTabListener(new MyTabsListener(sponsorTab)); tabC.setTabListener(new MyTabsListener(mapTab)); tabD.setTabListener(new MyTabsListener(DestinationTab)); tabE.setTabListener(new MyTabsListener(questTab)); actionBar.addTab(tabD, 0, true); actionBar.addTab(tabC, 1, false); actionBa
Tags (comma-separated)
Save Edits
Cancel