AppCompatActivity
open class AppCompatActivity : FragmentActivity, AppCompatCallback, TaskStackBuilder.SupportParentable, ActionBarDrawerToggle.DelegateProvider
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.
Summary
Public constructors | |
---|---|
<init>() Default constructor for AppCompatActivity. |
|
Alternate constructor that can be used to provide a default layout that will be inflated as part of |
Public methods | |
---|---|
open Unit |
addContentView(view: View!, params: LayoutParams!) |
open Unit | |
open Boolean |
dispatchKeyEvent(event: KeyEvent!) |
open T |
findViewById(@IdRes id: Int) |
open AppCompatDelegate | |
open ActionBarDrawerToggle.Delegate? | |
open MenuInflater | |
open Resources! | |
open ActionBar? |
Support library version of |
open Intent? |
Obtain an |
open Unit | |
open Unit |
onConfigurationChanged(@NonNull newConfig: Configuration) |
open Unit | |
open Unit |
onCreateSupportNavigateUpTaskStack(@NonNull : TaskStackBuilder) Support version of |
open Boolean | |
Boolean |
onMenuItemSelected(featureId: Int, @NonNull item: MenuItem) |
open Boolean |
onMenuOpened(featureId: Int, : Menu) Please note: AppCompat uses its own feature id for the action bar: |
open Unit |
onPanelClosed(featureId: Int, @NonNull : Menu) Call onOptionsMenuClosed() on fragments. |
open Unit |
onPrepareSupportNavigateUpTaskStack(@NonNull : TaskStackBuilder) Support version of |
open Unit |
onSupportActionModeFinished(@NonNull mode: ActionMode) Notifies the activity that a support action mode has finished. |
open Unit |
onSupportActionModeStarted(@NonNull mode: ActionMode) Notifies the Activity that a support action mode has been started. |
open Unit | |
open Boolean |
This method is called whenever the user chooses to navigate Up within your application's activity hierarchy from the action bar. |
open ActionMode? |
onWindowStartingSupportActionMode(@NonNull callback: ActionMode.Callback) Called when a support action mode is being started for this window. |
open Unit | |
open |