Android TabHost.TabSpec - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android TabHost.TabSpec class.

This code example shows how to use the following methods:setContent
	@Override 
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
 
		TabHost host = getTabHost();
		host.addTab(host.newTabSpec("one").setIndicator("TAB1").setContent(new Intent(this, Tab1Activity.class)));
		host.addTab(host.newTabSpec("two").setIndicator("TAB2").setContent(new Intent(this, Tab2Activity.class)));
	} 
} 
7
CodeRank
This code example shows how to use the following methods:setContent, setIndicator
        ctx.postIO(this);
    } 
 
    private void initPanel(String label, int tabViewId) {
        TabSpec tab = mTabHost.newTabSpec(label);
        tab.setContent(tabViewId);
        tab.setIndicator(label);
        mTabHost.addTab(tab);
    } 
 
    @Override 
    public void run() { 
        try { 
            init(); 
        } catch (IOException e) {
            e.printStackTrace();
        } 
    } 
 
    public void init() throws IOException { 
6
CodeRank
This code example shows how to use the following methods:setContent, setIndicator
  private String mRecordingId;
  private TabHost mTabHost;
 
  private TabSpec makeTab(String name, Class<? extends Activity> cls, int iconId) {
    TabSpec tab = mTabHost.newTabSpec(name);
    tab.setIndicator(name, getResources().getDrawable(iconId));
 
    Intent intent = new Intent(getBaseContext(), cls);
    if (mCollectionId != null) {
      intent.putExtra("collectionId", mCollectionId);
    } 
    if (mContentId != null) {
      intent.putExtra("contentId", mContentId);
    } 
    if (mOfferId != null) {
      intent.putExtra("offerId", mOfferId);
    } 
    if (mRecordingId != null) {
      intent.putExtra("recordingId", mRecordingId);
    } 

6
CodeRank
This code example shows how to use the following methods:setContent
 
        final TabHost tabHost = getTabHost();
 
        tabHost.addTab(tabHost.newTabSpec("tab1")
                .setIndicator("list")
                .setContent(new Intent(this, List1.class)));
 
        tabHost.addTab(tabHost.newTabSpec("tab2")
                .setIndicator("photo list")
                .setContent(new Intent(this, List8.class)));
         
        // This tab sets the intent flag so that it is recreated each time 
        // the tab is clicked. 
        tabHost.addTab(tabHost.newTabSpec("tab3")
                .setIndicator("destroy")
                .setContent(new Intent(this, Controls1.class)
                        .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));
    } 
} 
6
CodeRank
This code example shows how to use the following methods:setContent, setIndicator
This code example shows how to use the following methods:setContent, setIndicator
    	Intent intent = null;
    	if(tag=="Teams")
    		intent = new Intent(getApplicationContext(),TeamActivity.class);
    	if(tag=="Events")
    		intent = new Intent(getApplicationContext(),EventActivity.class);
    	spec.setContent(intent);
    	spec.setIndicator(tag);
    	 
    	return spec;
    	 
    } 
     
    public static TabHost getTabHost() {
    	return tabhost;
    } 
} 
5
CodeRank
This code example shows how to use the following methods:setContent, setIndicator
     } 
     
    private void addTabPendents() { 
        Intent intent = new Intent(this, NotFinishedTasksOverviewActivity.class);
        TabSpec spec = mTabHost.newTabSpec("Pendents");
        spec.setIndicator("Pendents", mResources
                          .getDrawable(android.R.drawable.ic_menu_agenda));
        spec.setContent(intent);
        mTabHost.addTab(spec);
     }  
     
    private void addTabCompletades() { 
         Intent intent = new Intent(this, FinishedTasksOverviewActivity.class);
         TabSpec spec = mTabHost.newTabSpec("Completades");
         spec.setIndicator("Completades", mResources
                           .getDrawable(android.R.drawable.ic_menu_agenda));
         spec.setContent(intent);
         mTabHost.addTab(spec);
     } 
     
5
CodeRank
This code example shows how to use the following methods:setContent, setIndicator
     
    private void addTabPendents() { 
        Intent intent = new Intent(this, NotFinishedCatTaskOverviewActivity.class);
        intent.putExtra("id", id);
        TabSpec spec = mTabHost.newTabSpec("Pendents");
        spec.setIndicator("Pendents", mResources
                          .getDrawable(android.R.drawable.ic_menu_agenda));
        spec.setContent(intent);
        mTabHost.addTab(spec);
     }  
     
    private void addTabCompletades() { 
         Intent intent = new Intent(this, FinishedCatTaskOverviewActivity.class);
         intent.putExtra("id", id);
         TabSpec spec = mTabHost.newTabSpec("Completades");
         spec.setIndicator("Completades", mResources
                           .getDrawable(android.R.drawable.ic_menu_agenda));
         spec.setContent(intent);
         mTabHost.addTab(spec);
     } 
5
CodeRank
This code example shows how to use the following methods:addState, setIndicator
This code example shows how to use the following methods:setContent, setIndicator
    } 
 
    private TabSpec newTab(String tag, int labelId, int tabContentId)
    { 
        TabSpec tabSpec = mTabHost.newTabSpec(tag);
        tabSpec.setContent(tabContentId);
        tabSpec.setIndicator(this.getText(labelId));
        return tabSpec;
    } 
 
    @Override 
    public void onTabChanged(String tabId)
    { 
        currentTabId = tabId;
        reloadTab(); 
    } 
 
    private void reloadTab() 
    { 
        if (SessionUtils.getSession(getActivity()) == null) { return; } 
5
CodeRank

Related Android TabHost.TabSpec Questions & Answers:

Other Android TabHost.TabSpec Examples

16:	        
17:	        // Tab for Photos
18:	        TabSpec photospec = tabHost.newTabSpec("Photos");
19:	        // setting Title and Icon for the Tab
20:	        photospec.setIndicator("Photos", getResources().getDrawable(R.drawable.icon_photos_tab));
-
23:	        
24:	        // Tab for Songs
25:	        TabSpec songspec = tabHost.newTabSpec("Songs");        
26:	        songspec.setIndicator("Songs", getResources().getDrawable(R.drawable.icon_songs_tab));
27:	        Intent songsIntent = new Intent(this, SongsActivity.class);
-
29:	        
30:	        // Tab for Videos
31:	        TabSpec videospec = tabHost.newTabSpec("Videos");
32:	        videospec.setIndicator("Videos", getResources().getDrawable(R.drawable.icon_videos_tab));
33:	        Intent videosIntent = new Intent(this, VideosActivity.class);

Read More

20:	        
21:	        // Inbox Tab
22:	        TabSpec inboxSpec = tabHost.newTabSpec(INBOX_SPEC);
23:	        // Tab Icon
24:	        inboxSpec.setIndicator(INBOX_SPEC, getResources().getDrawable(R.drawable.icon_inbox));
-
28:	        
29:	        // Outbox Tab
30:	        TabSpec outboxSpec = tabHost.newTabSpec(OUTBOX_SPEC);
31:	        outboxSpec.setIndicator(OUTBOX_SPEC, getResources().getDrawable(R.drawable.icon_outbox));
32:	        Intent outboxIntent = new Intent(this, OutboxActivity.class);
-
34:	        
35:	        // Profile Tab
36:	        TabSpec profileSpec = tabHost.newTabSpec(PROFILE_SPEC);
37:	        profileSpec.setIndicator(PROFILE_SPEC, getResources().getDrawable(R.drawable.icon_profile));
38:	        Intent profileIntent = new Intent(this, ProfileActivity.class);

Read More

See Code Examples for Android TabHost.TabSpec Methods: