Example usage for android.widget TabHost.TabSpec getTag

List of usage examples for android.widget TabHost.TabSpec getTag

Introduction

In this page you can find the example usage for android.widget TabHost.TabSpec getTag.

Prototype

@ViewDebug.ExportedProperty
public Object getTag() 

Source Link

Document

Returns this view's tag.

Usage

From source file:com.ubundude.timesheet.MainActivity.java

private static void addTab(MainActivity activity, TabHost tabHost, TabHost.TabSpec tabSpec, TabInfo tabInfo) {
    // Attach a Tab view factory to the spec
    tabSpec.setContent(activity.new TabFactory(activity));
    String tag = tabSpec.getTag();

    // Check to see if we already have a fragment for this tab, probably
    // from a previously saved state.  If so, deactivate it, because our
    // initial state is that a tab isn't shown.
    tabInfo.fragment = activity.getSupportFragmentManager().findFragmentByTag(tag);
    if (tabInfo.fragment != null && !tabInfo.fragment.isDetached()) {
        FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
        ft.detach(tabInfo.fragment);//from ww w . j a  v a 2  s . com
        ft.commit();
        activity.getSupportFragmentManager().executePendingTransactions();
    }

    tabHost.addTab(tabSpec);
}

From source file:au.com.wallaceit.reddinator.ViewRedditActivity.java

/**
 * @param activity;//from w  ww  .j  a va  2 s  .c  o  m
 * @param tabHost;
 * @param tabSpec;
 */
private static void addTab(ViewRedditActivity activity, TabHost tabHost, TabHost.TabSpec tabSpec,
        TabInfo tabInfo) {
    // Attach a Tab view factory to the spec
    tabSpec.setContent(activity.new TabFactory(activity));
    String tag = tabSpec.getTag();
    // Check to see if we already have a fragment for this tab, probably
    // from a previously saved state.  If so, deactivate it, because our
    // initial state is that a tab isn't shown.
    tabInfo.fragment = activity.getSupportFragmentManager().findFragmentByTag(tag);
    if (tabInfo.fragment != null && !tabInfo.fragment.isDetached()) {
        android.support.v4.app.FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
        ft.detach(tabInfo.fragment);
        ft.commit();
        activity.getSupportFragmentManager().executePendingTransactions();
    }

    tabHost.addTab(tabSpec);
}

From source file:com.esminis.server.library.dialog.about.AboutViewImpl.java

private void addTab(TabHost tabhost, Context context, @StringRes int title, final View view) {
    TabHost.TabSpec tab = tabhost.newTabSpec(context.getString(title));
    tab.setIndicator(tab.getTag());
    tab.setContent(new TabHost.TabContentFactory() {
        @Override//w  ww . j  ava  2  s  .  c o  m
        public View createTabContent(String tag) {
            return view;
        }
    });
    tabhost.addTab(tab);
}

From source file:br.com.cybereagle.androidlibrary.ui.adapter.TabsAdapter.java

public void addTab(TabHost.TabSpec tabSpec, Fragment fragment) {
    tabSpec.setContent(new DummyTabFactory(context));
    String tag = tabSpec.getTag();

    mapFragments.put(tag, fragment);//w w  w.j  a va2  s.co m
    tags.add(tag);
    tabHost.addTab(tabSpec);
    notifyDataSetChanged();
}

From source file:com.androidfactorem.visualcv.ui.adapter.FragmentTabAdapter.java

public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) {
    tabSpec.setContent(new DummyTabFactory(mContext));
    String tag = tabSpec.getTag();

    TabInfo info = new TabInfo(tag, clss, args);
    mTabs.add(info);//  www .  j a va  2s  . c o  m
    mTabHost.addTab(tabSpec);
    notifyDataSetChanged();
}

From source file:com.BibleQuote.BibleQuoteAndroid.ui.adapters.TabsAdapter.java

public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) {
    tabSpec.setContent(new DummyTabFactory(context));
    String tag = tabSpec.getTag();

    TabInfo info = new TabInfo(tag, clss, args);
    mTabs.add(info);// w  w  w.ja  v  a 2s .  c  om
    mTabHost.addTab(tabSpec);
    notifyDataSetChanged();
}

From source file:com.BibleQuote.ui.adapters.TabsAdapter.java

public void addTab(TabHost.TabSpec tabSpec, Fragment fragment, Bundle args) {
    tabSpec.setContent(new DummyTabFactory(mContext));
    String tag = tabSpec.getTag();

    TabInfo info = new TabInfo(tag, fragment, args);
    mTabs.add(info);//from   w w  w  .  j ava 2 s. c  om
    mTabHost.addTab(tabSpec);
    notifyDataSetChanged();
}

From source file:org.sigimera.app.android.TabManager.java

public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) {
    tabSpec.setContent(new DummyTabFactory(mActivity));
    String tag = tabSpec.getTag();

    TabInfo info = new TabInfo(tag, clss, args);

    // Check to see if we already have a fragment for this tab, probably
    // from a previously saved state.  If so, deactivate it, because our
    // initial state is that a tab isn't shown.
    info.fragment = mActivity.getSupportFragmentManager().findFragmentByTag(tag);
    if (info.fragment != null && !info.fragment.isDetached()) {
        FragmentTransaction ft = mActivity.getSupportFragmentManager().beginTransaction();
        ft.detach(info.fragment);//from   w  w w .  ja v a  2  s.  c  o  m
        ft.commit();
    }

    mTabs.put(tag, info);
    mTabHost.addTab(tabSpec);
}

From source file:com.android.packageinstaller.TabsAdapter.java

public void addTab(TabHost.TabSpec tabSpec, View view) {
    tabSpec.setContent(new DummyTabFactory(mContext));
    String tag = tabSpec.getTag();

    TabInfo info = new TabInfo(tag, view);
    mTabs.add(info);//from w w w .  j a v a 2  s. c  o m
    mTabHost.addTab(tabSpec);
    notifyDataSetChanged();
}

From source file:co.uk.alt236.restclient4android.adapters.RequestTabsAdapter.java

public void addTab(TabHost.TabSpec tabSpec, Class<? extends RestRequestFragmentInterface> clss, Bundle args) {
    tabSpec.setContent(new DummyTabFactory(mContext));
    String tag = tabSpec.getTag();

    TabInfo info = new TabInfo(tag, clss, args);
    mTabs.add(info);//from  w w w  .jav a 2s  .co m
    mTabHost.addTab(tabSpec);
    notifyDataSetChanged();
}