AppCompatActivity
public
class
AppCompatActivity
extends FragmentActivity
implements
AppCompatCallback,
TaskStackBuilder.SupportParentable,
ActionBarDrawerToggle.DelegateProvider
java.lang.Object | |||||||
↳ | android.content.Context | ||||||
↳ | android.content.ContextWrapper | ||||||
↳ | android.view.ContextThemeWrapper | ||||||
↳ | android.app.Activity | ||||||
↳ | androidx.activity.ComponentActivity | ||||||
↳ | androidx.fragment.app.FragmentActivity | ||||||
↳ | androidx.appcompat.app.AppCompatActivity |
Base class for activities that wish to use some of the newer platform features on older Android devices. Some of these backported features include:
- Using the action bar, including action items, navigation modes and more with
the
setSupportActionBar(Toolbar)
API. - Built-in switching between light and dark themes by using the
Theme.AppCompat.DayNight
theme andAppCompatDelegate.setDefaultNightMode(int)
API. - Integration with
DrawerLayout
by using thegetDrawerToggleDelegate()
API.
Note that every activity that extends this class has to be themed with
Theme.AppCompat
or a theme that extends
that theme.
Developer Guides
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.
Summary
Inherited constants | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.app.Activity
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From class
android.content.Context
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
android.content.ComponentCallbacks2
|
Inherited fields | ||
---|---|---|
From class
android.app.Activity
|
Public constructors | |
---|---|
AppCompatActivity()
Default constructor for AppCompatActivity. |
|
AppCompatActivity(int contentLayoutId)
Alternate constructor that can be used to provide a default layout
that will be inflated as part of |
Public methods | |
---|---|
void
|
addContentView(View view, ViewGroup.LayoutParams params)
|
void
|
closeOptionsMenu()
|
boolean
|
dispatchKeyEvent(KeyEvent event)
|
<T extends View>
T
|
findViewById(int id)
|
AppCompatDelegate
|
getDelegate()
|
ActionBarDrawerToggle.Delegate
|
getDrawerToggleDelegate()
|
MenuInflater
|
getMenuInflater()
|
Resources
|
getResources()
|
ActionBar
|
getSupportActionBar()
Support library version of |
Intent
|
getSupportParentActivityIntent()
Obtain an |
void
|
invalidateOptionsMenu()
|
void
|
onConfigurationChanged(Configuration newConfig)
Dispatch configuration change to all fragments. |
void
|
onContentChanged()
|
void
|
onCreateSupportNavigateUpTaskStack(TaskStackBuilder builder)
Support version of |
boolean
|
onKeyDown(int keyCode, KeyEvent event)
|
final
boolean
|
onMenuItemSelected(int featureId, MenuItem item)
Dispatch context and options menu to fragments. |
boolean
|
onMenuOpened(int featureId, Menu menu)
Please note: AppCompat uses its own feature id for the action bar:
|
void
|
onPanelClosed(int featureId, Menu menu)
Call onOptionsMenuClosed() on fragments. Please note: AppCompat uses its own feature id for the action bar:
|
void
|
onPrepareSupportNavigateUpTaskStack(TaskStackBuilder builder)
Support version of |
void
|
onSupportActionModeFinished(ActionMode mode)
Notifies the activity that a support action mode has finished. |
void
|
onSupportActionModeStarted(ActionMode mode)
Notifies the Activity that a support action mode has been started. |
void
|
onSupportContentChanged()
This method is deprecated.
Use |
boolean
|
onSupportNavigateUp()
This method is called whenever the user chooses to navigate Up within your application's activity hierarchy from the action bar. |
ActionMode
|
onWindowStartingSupportActionMode(ActionMode.Callback callback)
Called when a support action mode is being started for this window. |
void
|
openOptionsMenu()
|
void
|
setContentView(View view)
|
void
|
setContentView(int layoutResID)
|
void
|
setContentView(View view, ViewGroup.LayoutParams params)
|
void
|
setSupportActionBar(Toolbar toolbar)
Set a |
void
|
setSupportProgress(int progress)
This method is deprecated. Progress bars are no longer provided in AppCompat. |
void
|
setSupportProgressBarIndeterminate(boolean indeterminate)
This method is deprecated. Progress bars are no longer provided in AppCompat. |
void
|
setSupportProgressBarIndeterminateVisibility(boolean visible)
This method is deprecated. Progress bars are no longer provided in AppCompat. |
void
|
setSupportProgressBarVisibility(boolean visible)
This method is deprecated. Progress bars are no longer provided in AppCompat. |
void
|
setTheme(int resId)
|
ActionMode
|
startSupportActionMode(ActionMode.Callback callback)
Start an action mode. |
void
|
supportInvalidateOptionsMenu()
This method is deprecated.
Call |
void
|
supportNavigateUpTo(Intent upIntent)
Navigate from sourceActivity to the activity specified by upIntent, finishing sourceActivity in the process. |
boolean
|
supportRequestWindowFeature(int featureId)
Enable extended support library window features. |
boolean
|
supportShouldUpRecreateTask(Intent targetIntent)
Returns true if sourceActivity should recreate the task when navigating 'up' by using targetIntent. |
Protected methods | |
---|---|
void
|
attachBaseContext(Context newBase)
|
void
|
onDestroy()
Destroy all fragments. |
void
|
onNightModeChanged(int mode)
Called when the night mode has changed. |
void
|
onPostCreate(Bundle savedInstanceState)
|
void
|
onPostResume()
Dispatch onResume() to fragments. |
void
|
onStart()
Dispatch onStart() to all fragments. |
void
|
onStop()
Dispatch onStop() to all fragments. |
void
|
onTitleChanged(CharSequence title, int color)
|
Inherited methods | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class
androidx.fragment.app.FragmentActivity
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From class
androidx.activity.ComponentActivity
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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
androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
androidx.activity.contextaware.ContextAware
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
androidx.lifecycle.LifecycleOwner
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
androidx.lifecycle.ViewModelStoreOwner
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
androidx.lifecycle.HasDefaultViewModelProviderFactory
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
androidx.savedstate.SavedStateRegistryOwner
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
androidx.activity.OnBackPressedDispatcherOwner
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
androidx.activity.result.ActivityResultRegistryOwner
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
androidx.activity.result.ActivityResultCaller
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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
androidx.appcompat.app.AppCompatCallback
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
androidx.core.app.TaskStackBuilder.SupportParentable
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
android.view.LayoutInflater.Factory
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From interface
android.content.ComponentCallbacks
|
Public constructors
AppCompatActivity
public AppCompatActivity ()
Default constructor for AppCompatActivity. All Activities must have a default constructor
for API 27 and lower devices or when using the default
AppComponentFactory
.
AppCompatActivity
public AppCompatActivity (int contentLayoutId)
Alternate constructor that can be used to provide a default layout
that will be inflated as part of super.onCreate(savedInstanceState)
.
This should generally be called from your constructor that takes no parameters,
as is required for API 27 and lower or when using the default
AppComponentFactory
.
Parameters | |
---|---|
contentLayoutId |
int |
See also:
Public methods
addContentView
public void addContentView (View view, ViewGroup.LayoutParams params)
Parameters | |
---|---|
view |
View |
params |
ViewGroup.LayoutParams |
closeOptionsMenu
public void closeOptionsMenu ()
dispatchKeyEvent
public boolean dispatchKeyEvent (KeyEvent event)
Parameters | |
---|---|
event |
KeyEvent |
Returns | |
---|---|
boolean |
findViewById
public T findViewById (int id)
Parameters | |
---|---|
id |
int |
Returns | |
---|---|
T |
getDelegate
public AppCompatDelegate getDelegate ()
Returns | |
---|---|
AppCompatDelegate |
The AppCompatDelegate being used by this Activity.
|
getDrawerToggleDelegate
public ActionBarDrawerToggle.Delegate getDrawerToggleDelegate ()
Returns | |
---|---|
ActionBarDrawerToggle.Delegate |
getSupportActionBar
public ActionBar getSupportActionBar ()
Support library version of Activity.getActionBar()
.
Retrieve a reference to this activity's ActionBar.
Returns | |
---|---|
ActionBar |
The Activity's ActionBar, or null if it does not have one. |
getSupportParentActivityIntent
public Intent getSupportParentActivityIntent ()
Obtain an Intent
that will launch an explicit target activity
specified by sourceActivity's NavUtils.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.
Returns | |
---|---|
Intent |
a new Intent targeting the defined parent activity of sourceActivity |
invalidateOptionsMenu
public void invalidateOptionsMenu ()
onConfigurationChanged
public void onConfigurationChanged (Configuration newConfig)
Dispatch configuration change to all fragments.
Parameters | |
---|---|
newConfig |
Configuration |
onContentChanged
public void onContentChanged ()
onCreateSupportNavigateUpTaskStack
public void onCreateSupportNavigateUpTaskStack (TaskStackBuilder builder)
Support version of Activity.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 Activity.onNavigateUp()
if Activity.shouldUpRecreateTask(android.content.Intent)
returns true when supplied with the intent
returned by Activity.getParentActivityIntent()
.
Applications that wish to supply extra Intent parameters to the parent stack defined
by the manifest should override
onPrepareSupportNavigateUpTaskStack(androidx.core.app.TaskStackBuilder)
.
Parameters | |
---|---|
builder |
TaskStackBuilder : An empty TaskStackBuilder - the application should add intents representing
the desired task stack
|
onKeyDown
public boolean onKeyDown (int keyCode, KeyEvent event)
Parameters | |
---|---|
keyCode |
int |
event |
KeyEvent |
Returns | |
---|---|
boolean |
onMenuItemSelected
public final boolean onMenuItemSelected (int featureId, MenuItem item)
Dispatch context and options menu to fragments.
Parameters | |
---|---|
featureId |
int |
item |
MenuItem |
Returns | |
---|---|
boolean |
onMenuOpened
public boolean onMenuOpened (int featureId, Menu menu)
Please note: AppCompat uses its own feature id for the action bar:
FEATURE_SUPPORT_ACTION_BAR
.
Parameters | |
---|---|
featureId |
int |
menu |
Menu |
Returns | |
---|---|
boolean |
onPanelClosed
public void onPanelClosed (int featureId, Menu menu)
Call onOptionsMenuClosed() on frag