java.lang.Object | |||||
↳ | android.content.Context | ||||
↳ | android.content.ContextWrapper | ||||
↳ | android.view.ContextThemeWrapper | ||||
↳ | android.app.Activity | ||||
↳ | greendroid.app.GDActivity |
Known Direct Subclasses |
An GDActivity is a regular Activity that hosts an ActionBar
. It is
extremely simple to use as you have nothing particular to do. Indeed, the
ActionBar
is automatically added to your own layout when using the
getContentView()
method. You can also use one of the
setActionBarContentView utility methods. As a result, a basic GDActivity will
often be initialized using the following snippet of code:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setActionBarContentView(R.layout.main); }
An ActionBar
is a widget that may contains actions items and a title.
You can also set the title putting an extra string with the key
GD_ACTION_BAR_TITLE
in your Intent:
Intent intent = new Intent(this, MyGDActivity.class); intent.putExtra(ActionBarActivity.GD_ACTION_BAR_TITLE, "Next screen title"); startActivity(intent);
Note: An GDActivity automatically handle the type of the ActionBar
(taken from ActionBar.Type
) depending on the value returned by the
getHomeActivityClass()
method. However you can force the
type of the action bar in your constructor. Make the Activity declared in the AndroidManifest.xml
has at least a constructor with no arguments as required by the Android platform.
public MyGDActivity() { super(ActionBar.Type.Dashboard); }
All Activities that inherits from an GDActivity are notified when an action
button is tapped in the
onHandleActionBarItemClick(ActionBarItem, int)
method. By default
this method does nothing but return false.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Activity
| |||||||||||
From class
android.content.Context
| |||||||||||
From interface
greendroid.app.ActionBarActivity
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Default constructor. | |||||||||||
Create a new Activity with an |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add a new item to the
ActionBar . | |||||||||||
Add a new item to the
ActionBar . | |||||||||||
Adds a new item of type type to the
ActionBar . | |||||||||||
Adds a new item of type type to the
ActionBar . | |||||||||||
Returns the identifier of the layout that needs to be created for this
ActionBarActivity | |||||||||||
Returns the
ActionBar . | |||||||||||
The current
ActionBar.Type of the hosted ActionBar | |||||||||||
Returns the content view.
| |||||||||||
A simple utility method that casts the Application returned by
Activity.getApplication() into a
GDApplication | |||||||||||
Clients may use this method to listen to
ActionBarItem s clicks. | |||||||||||
Called at the end of the
onContentChanged() method. | |||||||||||
Called at the beginning of the
onContentChanged()
method. | |||||||||||
Set the activity content to an explicit view. | |||||||||||
Set the activity content to an explicit view. | |||||||||||
Set the activity content from a layout resource. | |||||||||||
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Call this method to ensure a layout has already been inflated and
attached to the top-level View of this Activity.
| |||||||||||
Verify the given layout contains everything needed by this Activity.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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
|
Default constructor.
Note: This constructor should never be used manually. In order to instantiate an Activity you should let the Android system do it for you by calling startActivity(Intent)
Create a new Activity with an ActionBar
of the given type.
Note: This constructor should never be used manually. In order to instantiate an Activity you should let the Android system do it for you by calling startActivity(Intent)
actionBarType | The ActionBar.Type for this Activity
|
---|
Returns the identifier of the layout that needs to be created for this
ActionBarActivity
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.
ActionBar
currently displayed on screen
The current ActionBar.Type
of the hosted ActionBar
ActionBar.Type
of the hosted
ActionBar
Returns the content view. Please note the content view is not the entire
view but a FrameLayout that contains everything but the
ActionBar
.
A simple utility method that casts the Application returned by
Activity.getApplication() into a GDApplication
GDApplication
Clients may use this method to listen to ActionBarItem
s clicks.
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. |
ActionBarItem
at position position. Otherwise it
returns false.
Called at the end of the onContentChanged()
method. This
may be use to initialize the content of the layout (titles, etc.)
Called at the beginning of the onContentChanged()
method. This may be used to initialize all references on elements.
Set the activity content to an explicit view. This view is placed directly into the activity's view hierarchy. It can itself be a complex view hierarchy.
This method is an equivalent to setContentView(View) that automatically
wraps the given layout in an ActionBarHost
if needed.
view | The desired content to display. |
---|
Set the activity content to an explicit view. This view is placed directly into the activity's view hierarchy. It can itself be a complex view hierarchy.
This method is an equivalent to setContentView(View, LayoutParams) that
automatically wraps the given layout in an ActionBarHost
if
needed.
view | The desired content to display. |
---|---|
params | Layout parameters for the view. |
Set the activity content from a layout resource. The resource will be inflated, adding all top-level views to the activity.
This method is an equivalent to setContentView(int) that automatically
wraps the given layout in an ActionBarHost
if needed..
resID | Resource ID to be inflated. |
---|
Call this method to ensure a layout has already been inflated and attached to the top-level View of this Activity.
Verify the given layout contains everything needed by this Activity. A
GDActivity, for instance, manages an ActionBarHost
. As a result
this method will return true of the current layout contains such a
widget.