public static void SetupTabbedNavigation(Activity containingActivity, int displayNameResourceId, int fragmentClassNameResourceId, int viewGroupId) { // Load the display values and class names from the resources String[] displayNameList = containingActivity.getResources().getStringArray(displayNameResourceId); String[] fragmentList = containingActivity.getResources().getStringArray(fragmentClassNameResourceId); if(fragmentList.length != displayNameList.length) { Log.e("SetupTabbedNavigation", "ERROR - List of fragment class names and list of display names do not contain the same number of entries"); return ; } ActionBar actionBar = containingActivity.getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ActionBar.TabListener tablistener; for (int i=0; i < fragmentList.length; i++) { tablistener = new SimpleTabListener(containingActivity, fragmentList[i], viewGroupId); actionBar.addTab( actionBar.newTab() .setText(displayNameList[i]) .setTabListener(tablistener) ); } }