public class

GDTabActivity

extends TabActivity
implements ActionBarActivity
java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.view.ContextThemeWrapper
         ↳ android.app.Activity
           ↳ android.app.ActivityGroup
             ↳ android.app.TabActivity
               ↳ greendroid.app.GDTabActivity

Class Overview

An equivalent to a TabActivity that manages fancy tabs and an ActionBar

Summary

[Expand]
Inherited Constants
From class android.app.Activity
From class android.content.Context
From interface greendroid.app.ActionBarActivity
Public Constructors
GDTabActivity()
Public Methods
ActionBarItem addActionBarItem(ActionBarItem item)
Add a new item to the ActionBar.
ActionBarItem addActionBarItem(ActionBarItem item, int itemId)
Add a new item to the ActionBar.
ActionBarItem addActionBarItem(ActionBarItem.Type actionBarItemType)
Adds a new item of type type to the ActionBar.
ActionBarItem addActionBarItem(ActionBarItem.Type actionBarItemType, int itemId)
Adds a new item of type type to the ActionBar.
void addTab(String tag, int labelId, Intent intent)
Add a new tab to this GDTabActivity
void addTab(String tag, CharSequence label, Intent intent)
Add a new tab to this GDTabActivity
int createLayout()
Returns the identifier of the layout that needs to be created for this ActionBarActivity
ActionBar getActionBar()
Returns the ActionBar.
FrameLayout getContentView()
Returns the content view.
GDApplication getGDApplication()
A simple utility method that casts the Application returned by Activity.getApplication() into a GDApplication
void onContentChanged()
boolean onHandleActionBarItemClick(ActionBarItem item, int position)
Clients may use this method to listen to ActionBarItems clicks.
void onPostContentChanged()
Called at the end of the onContentChanged() method.
void onPreContentChanged()
Called at the beginning of the onContentChanged() method.
void setTitle(int titleId)
void setTitle(CharSequence title)
Protected Methods
View createTabIndicator(CharSequence label)
View createTabIndicator(String tag, CharSequence label, ViewGroup parent)
Callback allowing client to create their own tabs.
void onCreate(Bundle savedInstanceState)
[Expand]
Inherited Methods
From class android.app.TabActivity
From class android.app.ActivityGroup
From class android.app.Activity
From class android.view.ContextThemeWrapper
From class android.content.ContextWrapper
From class android.content.Context
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.view.KeyEvent.Callback
From interface android.view.LayoutInflater.Factory
From interface android.view.View.OnCreateContextMenuListener
From interface android.view.Window.Callback
From interface greendroid.app.ActionBarActivity

Public Constructors

public GDTabActivity ()

Public Methods

public ActionBarItem addActionBarItem (ActionBarItem item)

Add a new item to the ActionBar.

Parameters
item The item to add to the ActionBar

public ActionBarItem addActionBarItem (ActionBarItem item, int itemId)

Add a new item to the ActionBar.

Parameters
item The item to add to the ActionBar
itemId Unique item ID. Use NONE if you do not need a unique ID.

public ActionBarItem addActionBarItem (ActionBarItem.Type actionBarItemType)

Adds a new item of type type to the ActionBar.

Parameters
actionBarItemType The item to add to the ActionBar

public ActionBarItem addActionBarItem (ActionBarItem.Type actionBarItemType, int itemId)

Adds a new item of type type to the ActionBar.

Parameters
actionBarItemType The item to add to the ActionBar
itemId Unique item ID. Use NONE if you do not need a unique ID.

public void addTab (String tag, int labelId, Intent intent)

Add a new tab to this GDTabActivity

Parameters
tag The tag associated this the new tab
labelId A resource ID to the label of the new tab
intent The Intent used to start the content of the tab

public void addTab (String tag, CharSequence label, Intent intent)

Add a new tab to this GDTabActivity

Parameters
tag The tag associated this the new tab
label The label of the new tab
intent The Intent used to start the content of the tab

public int createLayout ()

Returns the identifier of the layout that needs to be created for this ActionBarActivity

Returns
  • The layout identifier of the layout to create

public ActionBar getActionBar ()

Returns the ActionBar. Listening to ActionBar events should be done via the onHandleActionBarItemClick(ActionBarItem, int) method. Most of the time, this method don't need to be used directly.

Returns

public FrameLayout getContentView ()

Returns the content view. Please note the content view is not the entire view but a FrameLayout that contains everything but the ActionBar.

Returns
  • The content view

public GDApplication getGDApplication ()

A simple utility method that casts the Application returned by Activity.getApplication() into a GDApplication

Returns

public void onContentChanged ()

public boolean onHandleActionBarItemClick (ActionBarItem item, int position)

Clients may use this method to listen to ActionBarItems clicks.

Parameters
item The ActionBarItem that has been clicked
position The position of the clicked item. This number is equal or greater to zero. 0 is the leftmost item.
Returns
  • true if the method has handled the click on the ActionBarItem at position position. Otherwise it returns false.

public void onPostContentChanged ()

Called at the end of the onContentChanged() method. This may be use to initialize the content of the layout (titles, etc.)

public void onPreContentChanged ()

Called at the beginning of the onContentChanged() method. This may be used to initialize all references on elements.

public void setTitle (int titleId)

public void setTitle (CharSequence title)

Protected Methods

protected View createTabIndicator (CharSequence label)

protected View createTabIndicator (String tag, CharSequence label, ViewGroup parent)

Callback allowing client to create their own tabs.

Parameters
tag The tag of the tab to create
label The label that need to be displayed in the tab
parent The parent in which the tab will be added.Please note you shouldn't add the newly created/inflated View to the parent. GDTabActivity will deal with this automatically.
Returns
  • A newly allocated View representing the tab.

protected void onCreate (Bundle savedInstanceState)