java.lang.Object | ||||||
↳ | android.content.Context | |||||
↳ | android.content.ContextWrapper | |||||
↳ | android.view.ContextThemeWrapper | |||||
↳ | android.app.Activity | |||||
↳ | android.support.v4.app.FragmentActivity | |||||
↳ | android.support.v7.app.AppCompatActivity |
Known Direct Subclasses |
Base class for activities that use the support library action bar features.
You can add an ActionBar
to your activity when running on API level 7 or higher
by extending this class for your activity and setting the activity theme to
Theme.AppCompat
or a similar theme.
For information about how to use the action bar, including how to add action items, navigation modes and more, read the Action Bar API guide.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Activity
| |||||||||||
From class
android.content.Context
| |||||||||||
From interface
android.content.ComponentCallbacks2
|
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Activity
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add an additional content view to the activity.
| |||||||||||
Returns a
MenuInflater with this context.
| |||||||||||
Support library version of
getActionBar() .
| |||||||||||
Obtain an
Intent that will launch an explicit target activity
specified by sourceActivity's PARENT_ACTIVITY <meta-data>
element in the application's manifest.
| |||||||||||
Dispatch configuration change to all fragments.
| |||||||||||
This hook is called whenever the content view of the screen changes
(due to a call to
Window.setContentView or
Window.addContentView ).
| |||||||||||
Support version of
onCreateNavigateUpTaskStack(android.app.TaskStackBuilder) .
| |||||||||||
Dispatch context and options menu to fragments.
| |||||||||||
Support version of
onPrepareNavigateUpTaskStack(android.app.TaskStackBuilder) .
| |||||||||||
Notifies the activity that a support action mode has finished.
| |||||||||||
Notifies the Activity that a support action mode has been started.
| |||||||||||
This method is deprecated.
Use
onContentChanged() instead.
| |||||||||||
This method is called whenever the user chooses to navigate Up within your application's
activity hierarchy from the action bar.
| |||||||||||
Set the activity content to an explicit view.
| |||||||||||
Set the activity content from a layout resource.
| |||||||||||
Set the activity content to an explicit view.
| |||||||||||
This method is deprecated.
Progress bars are no longer provided in AppCompat.
| |||||||||||
This method is deprecated.
Progress bars are no longer provided in AppCompat.
| |||||||||||
This method is deprecated.
Progress bars are no longer provided in AppCompat.
| |||||||||||
This method is deprecated.
Progress bars are no longer provided in AppCompat.
| |||||||||||
Support library version of
invalidateOptionsMenu() .
| |||||||||||
Navigate from sourceActivity to the activity specified by upIntent, finishing sourceActivity
in the process.
| |||||||||||
Enable extended support library window features.
| |||||||||||
Returns true if sourceActivity should recreate the task when navigating 'up'
by using targetIntent.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Perform initialization of all fragments and loaders.
| |||||||||||
Destroy all fragments and loaders.
| |||||||||||
Called when activity start-up is complete (after
onStart()
and onRestoreInstanceState(Bundle) have been called).
| |||||||||||
Dispatch onResume() to fragments.
| |||||||||||
Dispatch onStop() to all fragments.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.support.v4.app.FragmentActivity
| |||||||||||
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.view.LayoutInflater.Factory2
| |||||||||||
From interface
android.view.Window.Callback
| |||||||||||
From interface
android.view.KeyEvent.Callback
| |||||||||||
From interface
android.view.View.OnCreateContextMenuListener
| |||||||||||
From interface
android.content.ComponentCallbacks2
| |||||||||||
From interface
android.support.v7.app.AppCompatCallback
| |||||||||||
From interface
android.support.v4.app.TaskStackBuilder.SupportParentable
| |||||||||||
From interface
android.support.v7.app.ActionBarDrawerToggle.DelegateProvider
| |||||||||||
From interface
android.view.LayoutInflater.Factory
| |||||||||||
From interface
android.content.ComponentCallbacks
|
Add an additional content view to the activity. Added after any existing ones in the activity -- existing views are NOT removed.
view | The desired content to display. |
---|---|
params | Layout parameters for the view. |
Support library version of getActionBar()
.
Retrieve a reference to this activity's ActionBar.
Obtain an Intent
that will launch an explicit target activity
specified by sourceActivity's PARENT_ACTIVITY
<meta-data>
element in the application's manifest. If the device is running
Jellybean or newer, the android:parentActivityName attribute will be preferred
if it is present.
Dispatch configuration change to all fragments.
newConfig | The new device configuration. |
---|
This hook is called whenever the content view of the screen changes
(due to a call to
Window.setContentView
or
Window.addContentView
).
Support version of onCreateNavigateUpTaskStack(android.app.TaskStackBuilder)
.
This method will be called on all platform versions.
Define the synthetic task stack that will be generated during Up navigation from
a different task.
The default implementation of this method adds the parent chain of this activity
as specified in the manifest to the supplied TaskStackBuilder
. Applications
may choose to override this method to construct the desired task stack in a different
way.
This method will be invoked by the default implementation of onNavigateUp()
if shouldUpRecreateTask(android.content.Intent)
returns true when supplied with the intent
returned by getParentActivityIntent()
.
Applications that wish to supply extra Intent parameters to the parent stack defined
by the manifest should override
onPrepareSupportNavigateUpTaskStack(android.support.v4.app.TaskStackBuilder)
.
builder | An empty TaskStackBuilder - the application should add intents representing the desired task stack |
---|
Dispatch context and options menu to fragments.
featureId | The panel that the menu is in. |
---|---|
item | The menu item that was selected. |
Support version of onPrepareNavigateUpTaskStack(android.app.TaskStackBuilder)
.
This method will be called on all platform versions.
Prepare the synthetic task stack that will be generated during Up navigation
from a different task.
This method receives the TaskStackBuilder
with the constructed series of
Intents as generated by onCreateSupportNavigateUpTaskStack(android.support.v4.app.TaskStackBuilder)
.
If any extra data should be added to these intents before launching the new task,
the application should override this method and add that data here.
builder | A TaskStackBuilder that has been populated with Intents by onCreateNavigateUpTaskStack. |
---|
Notifies the activity that a support action mode has finished. Activity subclasses overriding this method should call the superclass implementation.
mode | The action mode that just finished. |
---|
Notifies the Activity that a support action mode has been started. Activity subclasses overriding this method should call the superclass implementation.
mode | The new action mode. |
---|
This method is called whenever the user chooses to navigate Up within your application's activity hierarchy from the action bar.
If a parent was specified in the manifest for this activity or an activity-alias to it,
default Up navigation will be handled automatically. See
getSupportParentActivityIntent()
for how to specify the parent. If any activity
along the parent chain requires extra Intent arguments, the Activity subclass
should override the method onPrepareSupportNavigateUpTaskStack(android.support.v4.app.TaskStackBuilder)
to supply those arguments.
See Tasks and Back Stack from the developer guide and Navigation from the design guide for more information about navigating within your app.
See the TaskStackBuilder
class and the Activity methods
getSupportParentActivityIntent()
, supportShouldUpRecreateTask(android.content.Intent)
, and
supportNavigateUpTo(android.content.Intent)
for help implementing custom Up navigation.
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. When calling this method, the layout parameters of the
specified view are ignored. Both the width and the height of the view are
set by default to MATCH_PARENT
. To use
your own layout parameters, invoke
setContentView(android.view.View, android.view.ViewGroup.LayoutParams)
instead.
view | The desired content to display. |
---|
Set the activity content from a layout resource. The resource will be inflated, adding all top-level views to the activity.
layoutResID | Resource ID to be inflated. |
---|
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.
view | The desired content to display. |
---|---|
params | Layout parameters for the view. |
Set a Toolbar
to act as the ActionBar
for this
Activity window.
When set to a non-null value the getActionBar()
method will return
an ActionBar
object that can be used to control the given toolbar as if it were
a traditional window decor action bar. The toolbar's menu will be populated with the
Activity's options menu and the navigation button will be wired through the standard
home
menu select action.
In order to use a Toolbar within the Activity's window content the application
must not request the window feature FEATURE_ACTION_BAR
.
toolbar | Toolbar to set as the Activity's action bar |
---|
This method is deprecated.
Progress bars are no longer provided in AppCompat.
This method is deprecated.
Progress bars are no longer provided in AppCompat.
This method is deprecated.
Progress bars are no longer provided in AppCompat.
This method is deprecated.
Progress bars are no longer provided in AppCompat.
Support library version of invalidateOptionsMenu()
.
Invalidate the activity's options menu. This will cause relevant presentations of the menu to fully update via calls to onCreateOptionsMenu and onPrepareOptionsMenu the next time the menu is requested.
Navigate from sourceActivity to the activity specified by upIntent, finishing sourceActivity
in the process. upIntent will have the flag FLAG_ACTIVITY_CLEAR_TOP
set
by this method, along with any others required for proper up navigation as outlined
in the Android Design Guide.
This method should be used when performing up navigation from within the same task
as the destination. If up navigation should cross tasks in some cases, see
supportShouldUpRecreateTask(android.content.Intent)
.
upIntent | An intent representing the target destination for up navigation |
---|
Enable extended support library window features.
This is a convenience for calling
getWindow().requestFeature()
.
featureId | The desired feature as defined in
Window or WindowCompat . |
---|
Returns true if sourceActivity should recreate the task when navigating 'up' by using targetIntent.
If this method returns false the app can trivially call
supportNavigateUpTo(android.content.Intent)
using the same parameters to correctly perform
up navigation. If this method returns false, the app should synthesize a new task stack
by using TaskStackBuilder
or another similar mechanism to perform up navigation.
targetIntent | An intent representing the target destination for up navigation |
---|
Perform initialization of all fragments and loaders.
savedInstanceState | If the activity is being re-initialized after
previously being shut down then this Bundle contains the data it most
recently supplied in onSaveInstanceState(Bundle) . Note: Otherwise it is null. |
---|
Destroy all fragments and loaders.
Called when activity start-up is complete (after onStart()
and onRestoreInstanceState(Bundle)
have been called). Applications will
generally not implement this method; it is intended for system
classes to do final initialization after application code has run.
Derived classes must call through to the super class's implementation of this method. If they do not, an exception will be thrown.
savedInstanceState | If the activity is being re-initialized after
previously being shut down then this Bundle contains the data it most
recently supplied in onSaveInstanceState(Bundle) . Note: Otherwise it is null. |
---|
Dispatch onResume() to fragments.
Dispatch onStop() to all fragments. Ensure all loaders are stopped.