TabLayout and Orientation...

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

TabLayout and Orientation...

Postby atrus123 » Sun Oct 26, 2008 3:18 am

I posted this in Android-Beginners, but I never really got much of a response, so I'm hoping to get some insight here.

Basically, I noticed that my application drops back to the default tab (in a four tab layout) whenever I change orientation. The data within those tabs stays the same, so that stuff is getting saved, but what I want is to catch the current tab number and revert to that whenever swapping between landscape or portrait.

My tab layout is all in onCreate. What I have been trying is something like this:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         tabs.setCurrentTab(tabNumber);
  3.  
  4.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

And then i'm trying to catch tabNumber with something like this:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         tabs.setOnTabChangedListener(tabchangedlistener);
  3.  
  4.  
  5.  
  6.         private TabHost.OnTabChangeListener tabchangedlistener =
  7.  
  8.                 new TabHost.OnTabChangeListener(){
  9.  
  10.  
  11.  
  12.                         public void onTabChanged(String tabId) {
  13.  
  14.                                 // TODO Auto-generated method stub
  15.  
  16.                                 tabNumber = tabs.getCurrentTab();
  17.  
  18.                         }
  19.  
  20.                
  21.  
  22.         };
  23.  
  24.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

Ain't working.

Any thoughts on how I can do this?
atrus123
Developer
Developer
 
Posts: 26
Joined: Thu Oct 09, 2008 2:16 am
Location: Annapolis, MD

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Majestic-12 [Bot] and 5 guests