List of usage examples for android.app ActionBar NAVIGATION_MODE_TABS
int NAVIGATION_MODE_TABS
To view the source code for android.app ActionBar NAVIGATION_MODE_TABS.
Click Source Link
From source file:com.owo.android.mtPlease.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Set up the action bar final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayShowTitleEnabled(false); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); // setting for the sidedrawer // set the content view setBehindContentView(R.layout.drawer_search); getSlidingMenu().setFadeEnabled(true); getSlidingMenu().setShadowWidthRes(R.dimen.shadow_width); getSlidingMenu().setShadowDrawable(R.drawable.shadow); getSlidingMenu().setFadeDegree(0.90f); searchDrawerCloseButton = (ImageButton) findViewById(R.id.button_search_drawer_close); searchDrawerCloseButton.setOnClickListener(new OnClickListener() { @Override//ww w. j a v a 2 s .co m public void onClick(View v) { // TODO Auto-generated method stub getSlidingMenu().showContent(); } }); // Create the adapter that will return a fragment for each of the three // primary sections of the activity. mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // mViewPager.setOffscreenPageLimit(3); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } locationSelectSpinner = (Spinner) findViewById(R.id.spinner_location); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.location_array, R.layout.spinner_text); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); locationSelectSpinner.setAdapter(adapter); datePickerButton = (Button) findViewById(R.id.button_datepicker); datePickerButton.setText(modifiedDate); datePickerButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub FragmentManager dialogManager = getFragmentManager(); CalendarDialogFragment calendarDialogFragment = new CalendarDialogFragment(); calendarDialogFragment.setParentCaller(CalendarDialogFragment.PARENT_IS_ACTIVITY); calendarDialogFragment.show(dialogManager, "calendar_dialog_popped"); } }); // Activity emailAddress(SESSION_ID) MyPageFragment // . // searchButton = (ImageButton) findViewById(R.id.imageButton_search); searchButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub try { String region = locationSelectSpinner.getSelectedItem().toString(); if (region.equals("")) { region = "1"; } else if (region.equals("")) { region = "2"; } else { region = "3"; } String people = ((EditText) findViewById(R.id.editText_numberPeople)).getText().toString(); String[] tmp = (datePickerButton.getText().toString()).split(" "); String date = tmp[0].substring(0, 4) + "-" + tmp[1].split("")[0] + "-" + tmp[2].split("")[0]; String query = "?region=" + region + "&people=" + people + "&date=" + date + "&flag=1"; sendInfoToFragment(people, 2); sendInfoToFragment(query, 0); getSlidingMenu().showContent(); } catch (Exception e) { // TODO Auto-generated catch block Toast.makeText(getApplicationContext(), " ", Toast.LENGTH_SHORT); e.printStackTrace(); } } }); }
From source file:org.egokituz.arduino2android.activities.MainActivity.java
/** * Holder of the main tab/fragmen/section *//*from w ww . j a va 2 s.c om*/ //private TestSectionFragment m_TestFragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); m_ActivityContext = this; m_mainApp = (TestApplication) getApplication(); setContentView(R.layout.activity_main); // Create the adapter that will return a fragment for each of the three primary sections // of the app. m_CustomPagerAdapter = new CustomPagerAdapter(getSupportFragmentManager(), m_ActivityContext, m_mainApp); /* // find the retained fragment on activity restarts m_TestFragment = (TestSectionFragment) m_CustomPagerAdapter.getItem(0); if(m_TestFragment == null){ m_TestFragment = new TestSectionFragment(); m_TestFragment.setArguments(m_ActivityContext, m_mainApp); m_CustomPagerAdapter.addItem(m_TestFragment, 0); }*/ // Set up the action bar. final ActionBar actionBar = getActionBar(); // Specify that the Home/Up button should not be enabled, since there is no hierarchical // parent. //actionBar.setHomeButtonEnabled(false); // Specify that we will be displaying tabs in the action bar. actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Set up the ViewPager, attaching the adapter and setting up a listener for when the // user swipes between sections. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(m_CustomPagerAdapter); mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { // When swiping between different app sections, select the corresponding tab. // We can also use ActionBar.Tab#select() to do this if we have a reference to the // Tab. actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < m_CustomPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by the adapter. // Also specify this Activity object, which implements the TabListener interface, as the // listener for when this tab is selected. actionBar.addTab(actionBar.newTab().setText(m_CustomPagerAdapter.getPageTitle(i)).setTabListener(this)); } }
From source file:com.android.deskclock.DeskClock.java
private void createTabs(int selectedIndex) { mActionBar = getActionBar();//from w ww . java 2 s .co m mActionBar.setDisplayOptions(0); if (mActionBar != null) { mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mTimerTab = mActionBar.newTab(); mTimerTab.setIcon(R.drawable.timer_tab); mTimerTab.setContentDescription(R.string.menu_timer); mTabsAdapter.addTab(mTimerTab, TimerFragment.class, TIMER_TAB_INDEX); mClockTab = mActionBar.newTab(); mClockTab.setIcon(R.drawable.clock_tab); mClockTab.setContentDescription(R.string.menu_clock); mTabsAdapter.addTab(mClockTab, ClockFragment.class, CLOCK_TAB_INDEX); mStopwatchTab = mActionBar.newTab(); mStopwatchTab.setIcon(R.drawable.stopwatch_tab); mStopwatchTab.setContentDescription(R.string.menu_stopwatch); mTabsAdapter.addTab(mStopwatchTab, StopwatchFragment.class, STOPWATCH_TAB_INDEX); mActionBar.setSelectedNavigationItem(selectedIndex); } }
From source file:de.vanita5.twittnuker.activity.FiltersActivity.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, MODE_PRIVATE); setContentView(R.layout.activity_filters); mActionBar = getActionBar();/* w w w . j a va 2 s.c o m*/ mAdapter = new SupportTabsAdapter(this, getSupportFragmentManager(), null); mActionBar.setDisplayHomeAsUpEnabled(true); mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); addTab(FilteredUsersFragment.class, R.string.users, 0); addTab(FilteredKeywordsFragment.class, R.string.keywords, 1); addTab(FilteredSourcesFragment.class, R.string.sources, 2); addTab(FilteredLinksFragment.class, R.string.links, 3); mViewPager.setAdapter(mAdapter); mViewPager.setOnPageChangeListener(this); }
From source file:com.example.oblivion.swippedui.MainActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnNext = (ImageView) findViewById(R.id.a); btnPrev = (ImageView) findViewById(R.id.b); lblHeaderUserInApp = (TextView) findViewById(R.id.lblHeaderUserInApp); lblHeader1InApp = (TextView) findViewById(R.id.lblHeader1InApp); lblHeaderAgentInApp = (TextView) findViewById(R.id.lblHeaderAgentInApp); lblHeader2InApp = (TextView) findViewById(R.id.lblHeader2InApp); lblHeaderOutletInApp = (TextView) findViewById(R.id.lblHeaderOutletInApp); lblHeader3InApp = (TextView) findViewById(R.id.lblHeader3InApp); Typeface externalFont = Typeface.createFromAsset(getAssets(), "kalpurush.ttf"); lblHeaderUserInApp.setTypeface(externalFont); // lblHeader1InApp.setTypeface(externalFont); lblHeaderAgentInApp.setTypeface(externalFont); // lblHeader2InApp.setTypeface(externalFont); lblHeaderOutletInApp.setTypeface(externalFont); // lblHeader3InApp.setTypeface(externalFont); // Create the adapter that will return a fragment for each of the three primary sections // of the app. mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager()); // Set up the action bar. final ActionBar actionBar = getActionBar(); // Specify that the Home/Up button should not be enabled, since there is no hierarchical // parent.//from ww w. ja va 2s . c o m actionBar.setHomeButtonEnabled(false); // Specify that we will be displaying tabs in the action bar. actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Set up the ViewPager, attaching the adapter and setting up a listener for when the // user swipes between sections. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mAppSectionsPagerAdapter); mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { // When swiping between different app sections, select the corresponding tab. // We can also use ActionBar.Tab#select() to do this if we have a reference to the // Tab. actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by the adapter. // Also specify this Activity object, which implements the TabListener interface, as the // listener for when this tab is selected. actionBar.addTab( actionBar.newTab().setText(mAppSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } actionBar.hide(); btnNext.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mViewPager.setCurrentItem(mViewPager.getCurrentItem() - 1); } }); btnPrev.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mViewPager.setCurrentItem(mViewPager.getCurrentItem() + 1); } }); }
From source file:com.uoit.freeroomfinder.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Start BugSense if enabled if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("enable_bugsense", true)) { BugSenseHandler.initAndStartSession(MainActivity.this, "6e25a944"); }/*from w ww.j a v a 2 s .co m*/ setContentView(R.layout.activity_main); // Grab the shared preferences. sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); // Set up the date time formatter. DateTimeUtility.setFormatLocale(sharedPrefs.getBoolean("army_clock", true), this.getResources().getConfiguration().locale); // Set up the action bar. actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three // primary tabs of the app. mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } }
From source file:fr.leicht.androideip.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mContext = this; // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // For each of the sections in the app, add a tab to the action bar. actionBar.addTab(actionBar.newTab().setText(R.string.title_section1).setTabListener(this)); actionBar.addTab(actionBar.newTab().setText(R.string.title_section2).setTabListener(this)); actionBar.addTab(actionBar.newTab().setText(R.string.title_section3).setTabListener(this)); Thread threadInit = new Thread(new Runnable() { public void run() { Message msg = null;//from ww w . ja v a2 s . c o m try { comm = new SimpleLogixCommunicator("192.168.1.18", 0xAF12); //Declaration des Tag myTags.add(EJP = new Tag(comm, "EJP", 30000)); myTags.add(Temp_Ext = new Tag(comm, "Temp_Ext", 60000)); myTags.add(Temp_Confort_Quentin = new Tag(comm, "Temp_Confort_Quentin", 10000)); myTags.add(Temp_Confort_Salle = new Tag(comm, "Temp_Confort_Salle", 10000)); myTags.add(Temp_Confort_Tim = new Tag(comm, "Temp_Confort_Tim", 10000)); myTags.add(Temp_Tim = new Tag(comm, "Temp_Tim", 60000)); myTags.add(Temp_Salle = new Tag(comm, "Temp_Salle", 60000)); myTags.add(Temp_Quentin = new Tag(comm, "Temp_Quentin", 60000)); myTags.add(Autorisation_IHM_Plancher = new Tag(comm, "Autorisation_IHM_Plancher", 5000)); myTags.add(BP_IHM_Chauffage_Quentin = new Tag(comm, "BP_IHM_Chauffage_Quentin", 5000)); myTags.add(BP_IHM_Chauffage_Salle = new Tag(comm, "BP_IHM_Chauffage_Salle", 5000)); myTags.add(BP_IHM_Chauffage_Tim = new Tag(comm, "BP_IHM_Chauffage_Tim_Enabled", 5000)); myTags.add(intensite_A = new Tag(comm, "intensite_A", 1000)); myTags.add(Temp_Veranda = new Tag(comm, "Temp_Veranda", 60000)); myTags.add(BP_IHM_Light_SS_Milieu = new Tag(comm, "BP_IHM_Light_SS_Milieu", 60000)); myTags.add(Light_SS_Milieu = new Tag(comm, "Light_SS_Milieu", 500)); myTags.add(BP_IHM_Light_SS_Chenil = new Tag(comm, "BP_IHM_Light_SS_Chenil", 60000)); myTags.add(Light_SS_Chenil = new Tag(comm, "Light_SS_Chenil", 500)); myTags.add(BP_IHM_Light_SS_Garage = new Tag(comm, "BP_IHM_Light_SS_Garage", 60000)); myTags.add(Light_SS_Garage = new Tag(comm, "Light_SS_Garage", 500)); myTags.add(Time_Reste_Light_Devant = new Tag(comm, "Time_Reste_Light_Devant", 500)); myTags.add(BP_IHM_Light_Devant = new Tag(comm, "BP_IHM_Light_Devant", 50000)); myTags.add(BP_IHM_Off_Light_Devant = new Tag(comm, "BP_IHM_Off_Light_Devant", 50000)); myTags.add(Light_Devant = new Tag(comm, "Light_Devant", 5000)); Hora = new Tags(comm, "Hora", 7); enExecution = true; Integer i = 0; while (enExecution) { try { i++; for (Tag tag : myTags) { tag.updateTag(); } /*Hora.updateTag(); for (int k=0;k<7;k++) { Log.d("[EIP]","Hora :"+Hora.getStringValue(k)+"/"+k); }*/ //Log.d("[AndroidEIP]Main","WRITE Cycle :"+i); UpdateIHM("Cycle :" + i); Thread.sleep(100); } catch (InterruptedException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (PathSegmentException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (ItemNotFoundException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (ProcessingAttributesException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (InsufficientCommandException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (InsufficientNrOfAttributesException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (OtherWithExtendedCodeException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (ResponseBufferOverflowException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (InvalidTypeException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (EmbeddedServiceException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } } } catch (IOException e) { msg = mHandler.obtainMessage(MSG_ERR, (Object) e.getMessage()); mHandler.sendMessage(msg); Log.d("[AndroidEIP]Main", e.getMessage()); } catch (NotImplementedException e) { msg = mHandler.obtainMessage(MSG_ERR, (Object) e.getMessage()); mHandler.sendMessage(msg); Log.d("[AndroidEIP]Main", e.getMessage()); } } }); threadInit.start(); }
From source file:com.example.administrator.myapplication2._3_HB._3_MainActivity.java
/***************************************************** * Overrided methods/*from w ww. ja va2 s. co m*/ ******************************************************/ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_ACTION_BAR); //----- System, Context mContext = this; //.getApplicationContext(); mActivityHandler = new ActivityHandler(); AppSettings.initializeAppSettings(mContext); setContentView(R.layout._3_activity_main); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the primary sections of the app. mFragmentManager = getSupportFragmentManager(); mSectionsPagerAdapter = new FragmentAdapter(mFragmentManager, mContext, this, mActivityHandler); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by the adapter. actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } // Setup views mImageBT = (ImageView) findViewById(R.id.status_title); mImageBT.setImageDrawable(getResources().getDrawable(android.R.drawable.presence_invisible)); mTextStatus = (TextView) findViewById(R.id.status_text); mTextStatus.setText(getResources().getString(R.string.bt_state_init)); // Do data initialization after service started and binded doStartService(); }
From source file:edu.gatech.architourists.VAActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_va); ArchitectureDataSource ds = new ArchitectureDataSource(this); ds.open();/* w w w . ja v a 2s.com*/ allArchNames = ds.getSiteList(); architects = ds.getArchitectList(); stylesite = ds.getStyleList(); periodsite = ds.getPeriodList(); ds.close(); architects = makeAlphabetical(architects); stylesite = makeAlphabetical(stylesite); periodsite = makeAlphabetical(periodsite); // Create the adapter that will return a fragment for each of the three // primary sections // of the app. mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager()); // Set up the action bar. final ActionBar actionBar = getActionBar(); // // Specify that the Home/Up button should not be enabled, since there // is no hierarchical // // parent. // actionBar.setHomeButtonEnabled(false); // Specify that we will be displaying tabs in the action bar. actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Set up the ViewPager, attaching the adapter and setting up a listener // for when the // user swipes between sections. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mAppSectionsPagerAdapter); mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { // When swiping between different app sections, select // the corresponding tab. // We can also use ActionBar.Tab#select() to do this if // we have a reference to the // Tab. actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. // Also specify this Activity object, which implements the // TabListener interface, as the // listener for when this tab is selected. actionBar.addTab(actionBar.newTab().setText(tabTitles[i]).setTabListener(this)); } }
From source file:com.ijunes.transitions.StoryDetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_story_detail); if (savedInstanceState == null) { // Load the data from the intent on first pass Intent intent = getIntent();//from ww w . j a v a 2 s . c om String story_id = intent.getStringExtra(ARG_STORY_ID); mItem = StoryContent.STORY_MAP.get(story_id); } // Get hold of some relevant content final ViewGroup container = (ViewGroup) findViewById(R.id.container); // What are the layouts we should be able to transition between List<Integer> sceneLayouts = Arrays.asList(R.layout.content_scene_00, R.layout.content_scene_01, R.layout.content_scene_02); // Create the scenes sceneList = new ArrayList<Scene>(); for (int layout : sceneLayouts) { // Create the scene Scene scene = Scene.getSceneForLayout(container, layout, this); // Just before the transition starts, ensure that the content has been loaded scene.setEnterAction(new Runnable() { @Override public void run() { addContentToViewGroup(container); } }); // Save the scene into sceneList.add(scene); } // Build the transition manager TransitionInflater transitionInflater = TransitionInflater.from(this); mTransitionManager = transitionInflater.inflateTransitionManager(R.transition.story_transition_manager, container); // Show the Up button in the action bar. final ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); // Specify we want some tabs actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create a listener to cope with tab changes tabListener = new ActionBar.TabListener() { @Override public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) { // If there's a scene for this tab index, then transition to it if (tab.getPosition() <= sceneList.size()) { tabPosition = tab.getPosition(); performTransitionToScene(sceneList.get(tab.getPosition())); } } @Override public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) { // Can ignore this event } @Override public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) { // Can ignore this event } public void performTransitionToScene(Scene scene) { mTransitionManager.transitionTo(scene); } }; // Add some tabs for (int i = 0; i < sceneList.size(); i++) { actionBar.addTab(actionBar.newTab().setText("Scene " + i).setTabListener(tabListener)); } } // Load the first scene sceneList.get(0).enter(); }