Reputation: 7671
I am using the android tab layout. I have 4 tabs.My first tab "Home" is a list view.I want to invoke the fourth tab on the click of a list item in my "Home" tab.How can i achieive this?
Upvotes: 1
Views: 161
Reputation: 73484
Add a ListView.onItemClickListener
listView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView av, View v, int position, long id) {
mTabHost.setCurrentTab(3);
}
});
Upvotes: 0
Reputation: 200090
You can put this inside a child activity:
((YourTabActivity)getParent()).getTabHost().setCurrentTab(1);
In the case above, the second tab will be selected. Or if you use tags to reference your tabs, which is recommended, you can use:
((YourTabActivity)getParent()).getTabHost().setCurrentTabByTag("MY_SECOND_TAB");
Upvotes: 4