to top
Android APIs
public class

FragmentTabHost

extends TabHost
implements TabHost.OnTabChangeListener
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ android.widget.TabHost
           ↳ android.support.v13.app.FragmentTabHost

Class Overview

Version of FragmentTabHost that can be used with the platform Fragment APIs. You will not normally use this, instead using action bar tabs.

Summary

[Expand]
Inherited XML Attributes
From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
FragmentTabHost(Context context)
FragmentTabHost(Context context, AttributeSet attrs)
Public Methods
void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args)
void onTabChanged(String tabId)
void setOnTabChangedListener(TabHost.OnTabChangeListener l)
Register a callback to be invoked when the selected state of any of the items in this list changes
void setup()
This method is deprecated. Don't call the original TabHost setup, you must instead call setup(Context, FragmentManager) or setup(Context, FragmentManager, int).
void setup(Context context, FragmentManager manager, int containerId)
void setup(Context context, FragmentManager manager)
Protected Methods
void onAttachedToWindow()
This is called when the view is attached to a window.
void onDetachedFromWindow()
This is called when the view is detached from a window.
void onRestoreInstanceState(Parcelable state)
Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState().
Parcelable onSaveInstanceState()
Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state.
[Expand]
Inherited Methods
From class android.widget.TabHost
From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.ViewTreeObserver.OnTouchModeChangeListener
From interface android.view.accessibility.AccessibilityEventSource
From interface android.widget.TabHost.OnTabChangeListener

Public Constructors

public FragmentTabHost (Context context)

public FragmentTabHost (Context context, AttributeSet attrs)

Public Methods

public void addTab (TabHost.TabSpec tabSpec, Class<?> clss, Bundle args)

public void onTabChanged (String tabId)

public void setOnTabChangedListener (TabHost.OnTabChangeListener l)

Register a callback to be invoked when the selected state of any of the items in this list changes

Parameters
l The callback that will run

public void setup ()

This method is deprecated.
Don't call the original TabHost setup, you must instead call setup(Context, FragmentManager) or setup(Context, FragmentManager, int).

Call setup() before adding tabs if loading TabHost using findViewById(). However: You do not need to call setup() after getTabHost() in TabActivity. Example:

mTabHost = (TabHost)findViewById(R.id.tabhost);
mTabHost.setup();
mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1");

public void setup (Context context, FragmentManager manager, int containerId)

public void setup (Context context, FragmentManager manager)

Protected Methods

protected void onAttachedToWindow ()

This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before onDraw(android.graphics.Canvas), however it may be called any time before the first onDraw -- including before or after onMeasure(int, int).

protected void onDetachedFromWindow ()

This is called when the view is detached from a window. At this point it no longer has a surface for drawing.

protected void onRestoreInstanceState (Parcelable state)

Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState(). This function will never be called with a null state.

Parameters
state The frozen state that had previously been returned by onSaveInstanceState().

protected Parcelable onSaveInstanceState ()

Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state. This state should only contain information that is not persistent or can not be reconstructed later. For example, you will never store your current position on screen because that will be computed again when a new instance of the view is placed in its view hierarchy.

Some examples of things you may store here: the current cursor position in a text view (but usually not the text itself since that is stored in a content provider or other persistent storage), the currently selected item in a list view.

Returns
  • Returns a Parcelable object containing the view's current dynamic state, or null if there is nothing interesting to save. The default implementation returns null.