tags:

views:

109

answers:

1

hi.. i have a tab activity in my main actitvity,from it first how can i override the ontabchange listener in another activity. view

TabHost tabHost = getTabHost();

tabHost.addTab(tabHost.newTabSpec("tab1").setContent(
new Intent(this, Bru_Press_MostRecent.class)).setIndicator(
prepareTabView("Insider Extra",
R.drawable.most_recent_selector)));

  tabHost.addTab(tabHost.newTabSpec("tab2").setContent(  
                   new Intent(this, Bru_Press_BrowseBy.class))  
                   .setIndicator(  
                        prepareTabView("Browse By",  
                                  R.drawable.browse_by_selector))); 

when i choose second tab it moves to corresponding activity to show listview with content and again when 1 list onclick i moved to next 2 listview at the time the tab i set visible in bottom, when i click again it needs to move previous view but stays back in 2 list view alone,i need it to move 1st listview,how can i do it.

Thanks in advance.

A: 

how can i override the ontabchange listener in another activity

You can't. You need to set up the listener in the activity with the TabHost.

when i click again it needs to move previous view but stays back in 2 list view alone,i need it to move 1st listview

If you used Views as the contents of your tabs, you would not have this problem. Your application would run faster and take up less memory as well.

As it stands, your "2 list view" activity will need to call getParent(), cast that to be the activity class that has the TabHost, and call some private method on there that you implement. That method will call setCurrentTab(0); on the TabHost.

CommonsWare
let me have sample code snippets to implement what u said.
Tilsan The Fighter