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:

Note that every activity that extends this class has to be themed with Theme.AppCompat or a theme that extends that theme.

Inheritors

Constructors

Link copied to clipboard
constructor()
Default constructor for AppCompatActivity.
constructor(@LayoutRes contentLayoutId: Int)
Alternate constructor that can be used to provide a default layout that will be inflated as part of super.onCreate(savedInstanceState).

Functions

Link copied to clipboard
open fun addContentView(view: View, params: ViewGroup.LayoutParams)
Link copied to clipboard
open fun closeOptionsMenu()
Link copied to clipboard
Link copied to clipboard
open fun <T : View?> findViewById(@IdRes id: Int): T
Link copied to clipboard
@NonNull
open fun getDelegate(): @NonNull AppCompatDelegate
Link copied to clipboard
Link copied to clipboard
@NonNull
open fun getMenuInflater(): @NonNull MenuInflater
Link copied to clipboard
Link copied to clipboard
@Nullable
open fun getSupportActionBar(): @Nullable ActionBar
Support library version of getActionBar.
Link copied to clipboard
@Nullable
open fun getSupportParentActivityIntent(): @Nullable Intent
Obtain an android.content.Intent that will launch an explicit target activity specified by sourceActivity's PARENT_ACTIVITY element in the application's manifest.
Link copied to clipboard
Link copied to clipboard
open fun onConfigurationChanged(@NonNull newConfig: @NonNull Configuration)
Link copied to clipboard
open fun onContentChanged()
Link copied to clipboard
open fun onCreateSupportNavigateUpTaskStack(@NonNull builder: @NonNull TaskStackBuilder)
Support version of onCreateNavigateUpTaskStack.
Link copied to clipboard
open fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean
Link copied to clipboard
fun onMenuItemSelected(featureId: Int, item: @NonNull MenuItem): Boolean
Link copied to clipboard
open fun onMenuOpened(featureId: Int, menu: Menu): Boolean
Please note: AppCompat uses its own feature id for the action bar: FEATURE_SUPPORT_ACTION_BAR.
Link copied to clipboard
open fun onPanelClosed(featureId: Int, @NonNull menu: @NonNull Menu)
Please note: AppCompat uses its own feature id for the action bar: FEATURE_SUPPORT_ACTION_BAR.
Link copied to clipboard
open fun onPrepareSupportNavigateUpTaskStack(@NonNull builder: @NonNull TaskStackBuilder)
Support version of onPrepareNavigateUpTaskStack.
Link copied to clipboard
open fun onSupportActionModeFinished(@NonNull mode: @NonNull ActionMode)
Notifies the activity that a support action mode has finished.
Link copied to clipboard
open fun onSupportActionModeStarted(@NonNull mode: @NonNull ActionMode)
Notifies the Activity that a support action mode has been started.
Link copied to clipboard
Link copied to clipboard
This method is called whenever the user chooses to navigate Up within your application's activity hierarchy from the action bar.
Link copied to clipboard
@Nullable
open fun onWindowStartingSupportActionMode(callback: @NonNull ActionMode.Callback): @Nullable ActionMode
Called when a support action mode is being started for this window.
Link copied to clipboard
open fun openOptionsMenu()
Link copied to clipboard
open fun setContentView(view: View)
open fun setContentView(@LayoutRes layoutResID: Int)
open fun setContentView(view: View, params: ViewGroup.LayoutParams)
Link copied to clipboard
open fun setSupportActionBar(@Nullable toolbar: @Nullable Toolbar)
Set a Toolbar to act as the androidx.appcompat.app.ActionBar for this Activity window.
Link copied to clipboard
open fun setSupportProgress(progress: Int)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun setTheme(@StyleRes resId: Int)
Link copied to clipboard
@Nullable
open fun startSupportActionMode(callback: @NonNull ActionMode.Callback): @Nullable ActionMode
Start an action mode.
Link copied to clipboard
Link copied to clipboard
open fun supportNavigateUpTo(@NonNull upIntent: @NonNull Intent)
Navigate from sourceActivity to the activity specified by upIntent, finishing sourceActivity in the process.
Link copied to clipboard
Enable extended support library window features.
Link copied to clipboard
open fun supportShouldUpRecreateTask(@NonNull targetIntent: @NonNull Intent): Boolean
Returns true if sourceActivity should recreate the task when navigating 'up' by using targetIntent.