TabHost setCurrentTabByTag - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for TabHost setCurrentTabByTag method.

This code example shows how to use the following methods:setCurrentTabByTag
	@Override 
	public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
		// TODO Auto-generated method stub 
		if (isChecked) {
			if (buttonView == this.mRadioButtons[0]) {
				mHost.setCurrentTabByTag("home_tab");
			} 
			if (buttonView == this.mRadioButtons[1]) {
				mHost.setCurrentTabByTag("events_tab");
			} 
			if (buttonView == this.mRadioButtons[2]) {
				mHost.setCurrentTabByTag("forum_tab");
			} 
			if (buttonView == this.mRadioButtons[3]) {
				mHost.setCurrentTabByTag("weibo_tab");
			} 
			if (buttonView == this.mRadioButtons[4]) {
				mHost.setCurrentTabByTag("more_tab");
			} 
		} 

6
CodeRank
This code example shows how to use the following methods:getCurrentTab, setCurrentTab, setCurrentTabByTag
     @Override 
     protected void onRestoreInstanceState(Bundle state) {
         super.onRestoreInstanceState(state);
         String cur = state.getString("currentTab");
         if (cur != null) {
             mTabHost.setCurrentTabByTag(cur);
         } 
         if (mTabHost.getCurrentTab() < 0) {
             if (mDefaultTab != null) {
                 mTabHost.setCurrentTabByTag(mDefaultTab);
             } else if (mDefaultTabIndex >= 0) {
                 mTabHost.setCurrentTab(mDefaultTabIndex);
             } 
         } 
     } 
 
     @Override 
     protected void onSaveInstanceState(Bundle outState) {
         super.onSaveInstanceState(outState);
         String currentTabTag = mTabHost.getCurrentTabTag();
6
CodeRank
This code example shows how to use the following methods:setCurrentTabByTag
    } 
 
    @Override 
    protected void onRestoreInstanceState(Bundle savedInstanceState) {
        if (savedInstanceState != null) {
            mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab"));
        } 
    } 
 
    /** 
     * Backwards-compatibility mumbo jumbo 
     */ 
    static class DummyTabFactory implements TabHost.TabContentFactory {
 
        private final Context mContext;
 
        public DummyTabFactory(Context context) {
            mContext = context;
        } 
 
5
CodeRank
This code example shows how to use the following methods:addTab, newTabSpec, setCurrentTabByTag
    super.onCreate(paramBundle);
    requestWindowFeature(1);
    setContentView(2130903104);
    this.b = ((RadioGroup)findViewById(2131231031));
    this.c = getTabHost();
    this.c.addTab(this.c.newTabSpec("tab1").setIndicator(getString(2131429126)).setContent(new Intent(this, SoftwareManager2.class)));
    this.c.addTab(this.c.newTabSpec("tab2").setIndicator(getString(2131429127)).setContent(new Intent(this, APKManagerActivity.class)));
    this.b.setOnCheckedChangeListener(new aw(this));
    this.c.setCurrentTabByTag("tab1");
    ((RadioButton)findViewById(2131231032)).setChecked(true);
  } 
} 
 
/* Location:           C:\Users\sandrocheng.21KUNPENG\Desktop\classes_dex2jar\ 
 * Qualified Name:     com.keniu.security.software.SoftwareManagerTabActivity 
 * JD-Core Version:    0.6.2 
 */ 
6
CodeRank
This code example shows how to use the following methods:addTab, newTabSpec, setCurrentTabByTag
 
        // LayoutInflater.from(this).inflate(R.layout.main, 
        // tabs.getTabContentView(), true); 
 
        // create 1st tab spec 
        TabHost.TabSpec spec = tabs.newTabSpec("tab1");
        spec.setContent(new Intent(this, FirstTabActivity.class));
        // spec.setContent(R.id.tab1Clock); 
        spec.setIndicator("Clock");
        tabs.addTab(spec);
 
        // create 2nd tab spec 
        spec = tabs.newTabSpec("tab2");
        spec.setContent(new Intent(this, SecondTabActivity.class));
        // spec.setContent(R.id.tab2Button); 
        spec.setIndicator("Button");
        tabs.addTab(spec);
 
        // initialize tab focus 
        initTabFocus(); 

6
CodeRank
This code example shows how to use the following methods:addTab, newTabSpec, setCurrentTabByTag
	} 
 
	  public void init() 
	  { 
		  mth=this.getTabHost();
		  mth.addTab(mth.newTabSpec("0").setIndicator("a").setContent(new Intent(this,LampsActivity.class)));
		  mth.addTab(mth.newTabSpec("1").setIndicator("b").setContent(new Intent(this,HouseApplisActivity.class)));
		  mth.addTab(mth.newTabSpec("2").setIndicator("c").setContent(new Intent(this,DoorWindowsActivity.class)));
		  mth.addTab(mth.newTabSpec("3").setIndicator("d").setContent(new Intent(this,EnvironmentsActivity.class)));
		  mth.addTab(mth.newTabSpec("4").setIndicator("e").setContent(new Intent(this,SafeControlsActivity.class)));
		  mth.setCurrentTabByTag("0");
	  } 
	   
	} 
6
CodeRank
This code example shows how to use the following methods:setCurrentTabByTag, setOnTabChangedListener, setup
		super.onCreate(savedInstanceState);
//		setContentView(R.layout.tabhost); 
 
		this.initialiseTabHost(savedInstanceState);
		if(savedInstanceState != null){
			mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab"));
		} 
		 
		this.initializeViewPager();
	} 
	 
	protected void onSavedInsanceState(Bundle outState){
		outState.putString("tab", mTabHost.getCurrentTabTag());
		super.onSaveInstanceState(outState);
	} 
 
	@Override 
	public void onPageScrollStateChanged(int state) {}	// INTENTIONALLY LEFT BLANK
 
	@Override 

5
CodeRank
This code example shows how to use the following methods:getCurrentTab, setCurrentTab, setCurrentTabByTag
    protected void onRestoreInstanceState(Bundle state) {
        super.onRestoreInstanceState(state);
        ensureTabHost(); 
        String cur = state.getString("currentTab");
        if (cur != null) {
            mTabHost.setCurrentTabByTag(cur);
        } 
        if (mTabHost.getCurrentTab() < 0) {
            if (mDefaultTab != null) {
                mTabHost.setCurrentTabByTag(mDefaultTab);
            } else if (mDefaultTabIndex >= 0) {
                mTabHost.setCurrentTab(mDefaultTabIndex);
            } 
        } 
    } 
 
    @Override 
    protected void onPostCreate(Bundle icicle) {        
        super.onPostCreate(icicle);
 
5
CodeRank
This code example shows how to use the following methods:setCurrentTabByTag
This code example shows how to use the following methods:setCurrentTabByTag
      mTabs.clear();
      mLastTab = null;
    } 
 
    public void setCurrentTabByTag(final String tag) {
      mTabHost.setCurrentTabByTag(tag);
    } 
 
    protected TabInfo getTabInfo(final String tabId) { return mTabs.get(tabId); }
    protected TabInfo getLastTabInfo() { return mLastTab; }
 
    @Override 
    public void onTabChanged(final String tabId) {
      final TabInfo newTab = mTabs.get(tabId);
      if (mLastTab != newTab) {
        final FragmentTransaction ft = mActivity.getSupportFragmentManager()
            .beginTransaction(); 
        if (mLastTab != null && mLastTab.fragment != null) {
          ft.detach(mLastTab.fragment);
        } 
5
CodeRank

Related TabHost setCurrentTabByTag Questions & Answers:

setCurrentTabByTag Method Overview
See Code Examples for other Android TabHost Methods: