.setTabListener(new TabListener<FragmentStack.CountingFragment>( this, "simple", FragmentStack.CountingFragment.class))); bar.addTab(bar.newTab() .setText("Contacts") .setTabListener(new TabListener<LoaderCursor.CursorLoaderListFragment>( this, "contacts", LoaderCursor.CursorLoaderListFragment.class))); bar.addTab(bar.newTab() .setText("Apps") .setTabListener(new TabListener<LoaderCustom.AppListFragment>( this, "apps", LoaderCustom.AppListFragment.class))); bar.addTab(bar.newTab() .setText("Throttle") .setTabListener(new TabListener<LoaderThrottle.ThrottledLoaderListFragment>( this, "throttle", LoaderThrottle.ThrottledLoaderListFragment.class)));
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); bar.addTab(bar.newTab() .setText("Simple") .setTabListener(new TabListener<FragmentStack.CountingFragment>( this, "simple", FragmentStack.CountingFragment.class))); bar.addTab(bar.newTab() .setText("Contacts") .setTabListener(new TabListener<LoaderCursor.CursorLoaderListFragment>( this, "contacts", LoaderCursor.CursorLoaderListFragment.class))); bar.addTab(bar.newTab() .setText("Apps") .setTabListener(new TabListener<LoaderCustom.AppListFragment>( this, "apps", LoaderCustom.AppListFragment.class))); bar.addTab(bar.newTab() .setText("Throttle") .setTabListener(new TabListener<LoaderThrottle.ThrottledLoaderListFragment>( this, "throttle", LoaderThrottle.ThrottledLoaderListFragment.class))); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); bar.addTab(bar.newTab() .setText("Simple") .setTabListener(new TabListener<>( this, "simple", FragmentStack.CountingFragment.class))); bar.addTab(bar.newTab() .setText("Contacts") .setTabListener(new TabListener<>( this, "contacts", LoaderCursor.CursorLoaderListFragment.class))); bar.addTab(bar.newTab() .setText("Apps") .setTabListener(new TabListener<>( this, "apps", LoaderCustom.AppListFragment.class))); bar.addTab(bar.newTab() .setText("Throttle") .setTabListener(new TabListener<>( this, "throttle", LoaderThrottle.ThrottledLoaderListFragment.class))); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); } }