Most visited

Recently visited

FragmentTabHost

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


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

Summary

Inherited XML attributes

From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View

Inherited constants

From class android.view.ViewGroup
From class android.view.View

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.

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.view.ViewTreeObserver.OnTouchModeChangeListener
From interface android.view.ViewParent
From interface android.view.ViewManager
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource
From interface android.widget.TabHost.OnTabChangeListener

Public constructors

FragmentTabHost

FragmentTabHost (Context context)

Parameters
context Context

FragmentTabHost

FragmentTabHost (Context context, 
                AttributeSet attrs)

Parameters
context Context
attrs AttributeSet

Public methods

addTab

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

Parameters
tabSpec TabHost.TabSpec
clss Class
args Bundle

onTabChanged

void onTabChanged (String tabId)

Parameters
tabId String

setOnTabChangedListener

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 TabHost.OnTabChangeListener: The callback that will run

setup

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");

setup

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

Parameters
context Context
manager FragmentManager
containerId int

setup

void setup (Context context, 
                FragmentManager manager)

Parameters
context Context
manager FragmentManager

Protected methods

onAttachedToWindow

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).

onDetachedFromWindow

void onDetachedFromWindow ()

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

onRestoreInstanceState

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 Parcelable: The frozen state that had previously been returned by onSaveInstanceState().

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. 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
Parcelable 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.

Hooray!