Reputation: 779
After clicking on a button in DialogFragment, I want to switch to tab number 3. How can I do this?
Upvotes: 2
Views: 5747
Reputation: 779
In Tab Fragment:
public void setCurrentTab(int tab_index){
mTabHost = (FragmentTabHost)getActivity().findViewById(android.R.id.tabhost);
mTabHost.setCurrentTab(tab_index);
}
In click event of the button of DialogFragment:
FragmentTabHost tabHost = (FragmentTabHost) getActivity().findViewById(android.R.id.tabhost);
tabHost.setCurrentTab(3);
Upvotes: 12