Reputation: 3137
So I'm using Sherlock library to show ActionBar(that needs it in 4.2 and earlier) and a Navigation tab bar. I want to show some Activity content in tab1 and other activity in tab2 when pressing it. Is that possible with Sherlock library? If not please provide me some other solutions.
public class TabNavigation extends SherlockActivity implements ActionBar.TabListener {
private TextView mSelected;
@Override
public void onCreate(Bundle savedInstanceState) {
setTheme(SampleList.THEME); //Used for theme switching in samples
super.onCreate(savedInstanceState);
setContentView(R.layout.tab_navigation);
mSelected = (TextView)findViewById(R.id.text);
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
for (int i = 1; i <= 3; i++) {
ActionBar.Tab tab = getSupportActionBar().newTab();
tab.setText("Tab " + i);
tab.setTabListener(this);
getSupportActionBar().addTab(tab);
}
}
@Override
public void onTabReselected(Tab tab, FragmentTransaction transaction) {
}
@Override
public void onTabSelected(Tab tab, FragmentTransaction transaction) {
//LAUNCH ACTIVITIES HERE! POSSIBLE?
}
@Override
public void onTabUnselected(Tab tab, FragmentTransaction transaction) {
}
}
Upvotes: 0
Views: 231
Reputation: 1006734
Is that possible with Sherlock library?
No.
If not please provide me some other solutions.
Use fragments for your tabs. Or, otherwise modify the UI of your existing activity. Activities-in-tabs has been deprecated for nearly two years.
Upvotes: 1