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 Unit |
setContentView(@LayoutRes layoutResID: Int) |
open Unit |
setContentView(view: View!) |
open Unit |
setContentView(view: View!, params: LayoutParams!) |
open Unit |
setSupportActionBar(@Nullable toolbar: Toolbar?) Set a |
open Unit |
setSupportProgress(progress: Int) |
open Unit |
setSupportProgressBarIndeterminate(indeterminate: Boolean) |
open Unit | |
open Unit |
setSupportProgressBarVisibility(visible: Boolean) |
open Unit | |
open ActionMode? |
startSupportActionMode(@NonNull callback: ActionMode.Callback) Start an action mode. |
open Unit | |
open Unit |
supportNavigateUpTo(@NonNull : Intent) Navigate from sourceActivity to the activity specified by upIntent, finishing sourceActivity in the process. |
open Boolean |
supportRequestWindowFeature(featureId: Int) Enable extended support library window features. |
open Boolean |
supportShouldUpRecreateTask(@NonNull targetIntent: Intent) Returns true if sourceActivity should recreate the task when navigating 'up' by using targetIntent. |
Protected methods | |
---|---|
open Unit |
attachBaseContext(newBase: Context!) |
open Unit | |
open Unit |
onNightModeChanged(mode: Int) Called when the night mode has changed. |
open Unit |
onPostCreate(@Nullable savedInstanceState: Bundle?) |
open Unit | |
open Unit |
onStart() |
open Unit |
onStop() |
open Unit |
onTitleChanged(title: CharSequence!, color: Int) |
Inherited functions | |
---|---|