ComponentActivity


open class ComponentActivity : Activity, LifecycleOwner, ContextAware, ViewModelStoreOwner, HasDefaultViewModelProviderFactory, SavedStateRegistryOwner, OnBackPressedDispatcherOwner, NavigationEventDispatcherOwner, ActivityResultRegistryOwner, ActivityResultCaller, OnConfigurationChangedProvider, OnTrimMemoryProvider, OnNewIntentProvider, OnMultiWindowModeChangedProvider, PictureInPictureProvider, MenuHost, FullyDrawnReporterOwner

Known direct subclasses
FragmentActivity

Base class for activities that want to use the support-based Fragments.

PreviewActivity

Activity used to run @Composable previews from Android Studio.

Known indirect subclasses
AppCompatActivity

Base class for activities that wish to use some of the newer platform features on older Android devices.

BaseCarAppActivity

Core logic for CarAppLibrary Activity interaction with a host.

CarAppActivity

The class representing a car app activity in the main display.

LauncherActivity

This class handles providing the right launcher activity when running native applications and Car App Library applications.


Base class for activities that enables composition of higher level components.

Rather than all functionality being built directly into this class, only the minimal set of lower level building blocks are included. Higher level components can then be used as needed without enforcing a deep Activity class hierarchy or strong coupling between components.

Summary

Public constructors

Alternate constructor that can be used to provide a default layout that will be inflated as part of super.onCreate(savedInstanceState).

Public functions

open Unit
open Unit

Adds the given MenuProvider to this MenuHost.

open Unit

Adds the given MenuProvider to this MenuHost.

open Unit
addMenuProvider(
    provider: MenuProvider,
    owner: LifecycleOwner,
    state: Lifecycle.State
)

Adds the given MenuProvider to this MenuHost once the given LifecycleOwner reaches the given Lifecycle.State.

final Unit

Add a new listener that will get a callback associated with ComponentCallbacks.onConfigurationChanged with the new Configuration.

final Unit

{@inheritDoc}

final Unit

Add a new listener that will get a callback associated with Activity.onMultiWindowModeChanged with the new MultiWindowModeChangedInfo.

final Unit

Add a new listener that will get a callback associated with Activity.onNewIntent with the new Intent.

final Unit

Add a new listener that will get a callback associated with Activity.onPictureInPictureModeChanged with the new PictureInPictureModeChangedInfo.

final Unit

Add a new listener that will get a callback associated with Activity.onPictureInPictureUiStateChanged with the new PictureInPictureUiStateCompat.

final Unit

Add a new listener that will get a callback associated with ComponentCallbacks2.onTrimMemory with the int representing the level of trimming.

final Unit

Add a new listener that will get a callback associated with Activity.onUserLeaveHint

final Unit

Available since API 24 in the framework Activity class, puts the activity in picture-in-picture mode if possible in the current system state.

open Unit

Sets the view tree owners before setting the content view so that the inflation process and attach listeners will see them already present.

open Unit

Invalidates the android.view.Menu to ensure that what is displayed matches the current internal state of the menu.

open Unit

This function is deprecated. This method has been deprecated in favor of using the {@link OnBackPressedDispatcher} via {@link #getOnBackPressedDispatcher()}.

open Unit

{@inheritDoc}

open Boolean
onCreatePanelMenu(featureId: Int, menu: Menu)
open Boolean
onMenuItemSelected(featureId: Int, item: MenuItem)
open Unit

This function is deprecated. Deprecated in android.app.Activity

open Unit
@RequiresApi(api = 26)
@CallSuper
onMultiWindowModeChanged(
    isInMultiWindowMode: Boolean,
    newConfig: Configuration
)

{@inheritDoc}

open Unit
onPanelClosed(featureId: Int, menu: Menu)
open Unit
@CallSuper
onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean)

This function is deprecated. Deprecated in android.app.Activity

open Unit
@RequiresApi(api = 26)
@CallSuper
onPictureInPictureModeChanged(
    isInPictureInPictureMode: Boolean,
    newConfig: Configuration
)

{@inheritDoc}

open Unit

{@inheritDoc}

open Boolean
onPreparePanel(featureId: Int, view: View?, menu: Menu)
open Unit
@CallSuper
onRequestPermissionsResult(
    requestCode: Int,
    permissions: Array<String>,
    grantResults: IntArray
)

This function is deprecated. This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an {@link ActivityResultContract} and the prebuilt contracts for common intents available in {@link androidx.activity.result.contract.ActivityResultContracts}, provides hooks for testing, and allow receiving results in separate, testable classes independent from your activity.

open Any?

This function is deprecated. Use a {@link androidx.lifecycle.ViewModel} to store non config state.

final Any?

Retain all appropriate non-config state.

open Unit

{@inheritDoc}

open Context?

Get the Context if it is currently available.

final ActivityResultLauncher<I>
<I : Any?, O : Any?> registerForActivityResult(
    contract: ActivityResultContract<I, O>,
    callback: ActivityResultCallback<O>
)

Register a request to start an activity for result, designated by the given contract.

final ActivityResultLauncher<I>
<I : Any?, O : Any?> registerForActivityResult(
    contract: ActivityResultContract<I, O>,
    registry: ActivityResultRegistry,
    callback: ActivityResultCallback<O>
)

Register a request to start an activity for result, designated by the given contract.

open Unit

Removes the given MenuProvider from this MenuHost.

final Unit

Remove a previously added listener.

final Unit

Remove a OnContextAvailableListener previously added via addOnContextAvailableListener.

final Unit

Remove a previously added listener.

final Unit

Remove a previously added listener.

final Unit

Remove a previously added listener.

final Unit

Remove a previously added listener.

final Unit

Remove a previously added listener.

final Unit

Remove a previously added listener.

open Unit
open Unit
setContentView(layoutResID: @LayoutRes Int)
open Unit
open Unit
final Unit

Available since API 26 in the framework Activity class, updates the properties of the picture-in-picture activity, or sets it to be used later when enterPictureInPictureMode is called

open Unit
startActivityForResult(intent: Intent, requestCode: Int)

This function is deprecated. This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an {@link ActivityResultContract} and the prebuilt contracts for common intents available in {@link androidx.activity.result.contract.ActivityResultContracts}, provides hooks for testing, and allow receiving results in separate, testable classes independent from your activity.

open Unit
startActivityForResult(intent: Intent, requestCode: Int, options: Bundle?)

This function is deprecated. This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an {@link ActivityResultContract} and the prebuilt contracts for common intents available in {@link androidx.activity.result.contract.ActivityResultContracts}, provides hooks for testing, and allow receiving results in separate, testable classes independent from your activity.

open Unit
startIntentSenderForResult(
    intent: IntentSender,
    requestCode: Int,
    fillInIntent: Intent?,
    flagsMask: Int,
    flagsValues: Int,
    extraFlags: Int
)

This function is deprecated. This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an {@link ActivityResultContract} and the prebuilt contracts for common intents available in {@link androidx.activity.result.contract.ActivityResultContracts}, provides hooks for testing, and allow receiving results in separate, testable classes independent from your activity.

open Unit
startIntentSenderForResult(
    intent: IntentSender,
    requestCode: Int,
    fillInIntent: Intent?,
    flagsMask: Int,
    flagsValues: Int,
    extraFlags: Int,
    options: Bundle?
)

This function is deprecated. This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an {@link ActivityResultContract} and the prebuilt contracts for common intents available in {@link androidx.activity.result.contract.ActivityResultContracts}, provides hooks for testing, and allow receiving results in separate, testable classes independent from your activity.

Protected functions

open Unit
@CallSuper
onActivityResult(requestCode: Int, resultCode: Int, data: Intent?)

This function is deprecated. This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an {@link ActivityResultContract} and the prebuilt contracts for common intents available in {@link androidx.activity.result.contract.ActivityResultContracts}, provides hooks for testing, and allow receiving results in separate, testable classes independent from your activity.

open Unit
onCreate(savedInstanceState: Bundle?)

{@inheritDoc}

open Unit

{@inheritDoc}

open Unit
open Unit

{@inheritDoc}

Public properties

final ActivityResultRegistry

Get the ActivityResultRegistry associated with this activity.

open CreationExtras
open ViewModelProvider.Factory
open FullyDrawnReporter

Retrieve the FullyDrawnReporter that should handle the independent parts of the UI that separately report that they are fully drawn.

open Any?
open Lifecycle

{@inheritDoc}

open NavigationEventDispatcher

Lazily provides a NavigationEventDispatcher for back navigation handling, including support for predictive back gestures introduced in Android 13 (API 33+).

final OnBackPressedDispatcher

Retrieve the OnBackPressedDispatcher that will be triggered when onBackPressed is called.

final SavedStateRegistry
open ViewModelStore

Extension functions

inline Lazy<VM>
@MainThread
<VM : ViewModel> ComponentActivity.viewModels(
    noinline extrasProducer: (() -> CreationExtras)?,
    noinline factoryProducer: (() -> ViewModelProvider.Factory)?
)

Returns a Lazy delegate to access the ComponentActivity's ViewModel, if factoryProducer is specified then ViewModelProvider.Factory returned by it will be used to create ViewModel first time.

Unit
ComponentActivity.setContent(
    parent: CompositionContext?,
    content: @Composable () -> Unit
)

Composes the given composable into the given activity.

Unit
ComponentActivity.enableEdgeToEdge(
    statusBarStyle: SystemBarStyle,
    navigationBarStyle: SystemBarStyle
)

Enables the edge-to-edge display for this ComponentActivity.

Inherited functions

From android.app.Activity
open Unit
open Unit
open Unit
open PendingIntent
createPendingResult(requestCode: Int, data: Intent, flags: Int)
Unit

This function is deprecated. Deprecated in Java

Unit
open Unit
dump(
    prefix: String,
    fd: FileDescriptor?,
    writer: PrintWriter,
    args: Array<String>?
)
open Unit

This function is deprecated. Deprecated in Java

open Boolean
open T
<T : View> findViewById(id: Int)
open Unit
open Unit
finishActivity(requestCode: Int)
open Unit
finishActivityFromChild(child: Activity, requestCode: Int)

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open SharedPreferences
open Boolean
open Unit
Cursor
managedQuery(
    uri: Uri,
    projection: Array<String>,
    selection: String,
    selectionArgs: Array<String>,
    sortOrder: String
)

This function is deprecated. Deprecated in Java

open Boolean
open Boolean
navigateUpTo(upIntent: Intent)
open Boolean
navigateUpToFromChild(child: Activity, upIntent: Intent)

This function is deprecated. Deprecated in Java

open Unit
onActivityReenter(resultCode: Int, data: Intent)
open Unit
onActivityResult(
    requestCode: Int,
    resultCode: Int,
    data: Intent?,
    caller: ComponentCaller
)
open Unit

This function is deprecated. Deprecated in Java

open Unit
onChildTitleChanged(childActivity: Activity, title: CharSequence)
open Boolean
open Unit
open Unit
onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?)
open CharSequence?
open Dialog

This function is deprecated. Deprecated in Java

open Dialog?
onCreateDialog(id: Int, args: Bundle)

This function is deprecated. Deprecated in Java

open Unit
open Boolean
open Boolean
onCreateThumbnail(outBitmap: Bitmap, canvas: Canvas)

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Boolean
open Unit
onGetDirectActions(
    cancellationSignal: CancellationSignal,
    callback: Consumer<MutableList<DirectAction>>
)
open Boolean
onKeyShortcut(keyCode: Int, event: KeyEvent)
open Unit
open Unit
open Boolean
open Boolean

This function is deprecated. Deprecated in Java

open Unit
onNewIntent(intent: Intent, caller: ComponentCaller)
open Boolean
open Unit
open Unit
open Unit
onPerformDirectAction(
    actionId: String,
    arguments: Bundle,
    cancellationSignal: CancellationSignal,
    resultListener: Consumer<Bundle>
)
open Boolean
open Unit
onPostCreate(savedInstanceState: Bundle?)
open Unit
onPostCreate(
    savedInstanceState: Bundle?,
    persistentState: PersistableBundle?
)
open Unit
open Unit
onPrepareDialog(id: Int, dialog: Dialog)

This function is deprecated. Deprecated in Java

open Unit
onPrepareDialog(id: Int, dialog: Dialog, args: Bundle)

This function is deprecated. Deprecated in Java

open Unit
open Boolean
open Unit
open Unit
open Uri
open Unit
onRequestPermissionsResult(
    requestCode: Int,
    permissions: Array<String>,
    grantResults: IntArray,
    deviceId: Int
)
open Unit
open Unit
onRestoreInstanceState(savedInstanceState: Bundle)
open Unit
onRestoreInstanceState(
    savedInstanceState: Bundle?,
    persistentState: PersistableBundle?
)
open Unit
open Unit
onSaveInstanceState(
    outState: Bundle,
    outPersistentState: PersistableBundle
)
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
onTitleChanged(title: CharSequence, color: Int)
open Unit
onTopResumedActivityChanged(isTopResumedActivity: Boolean)
open Boolean
open Boolean
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
overrideActivityTransition(
    overrideType: Int,
    enterAnim: Int,
    exitAnim: Int
)
open Unit
overrideActivityTransition(
    overrideType: Int,
    enterAnim: Int,
    exitAnim: Int,
    backgroundColor: Int
)
open Unit
overridePendingTransition(enterAnim: Int, exitAnim: Int)

This function is deprecated. Deprecated in Java

open Unit
overridePendingTransition(
    enterAnim: Int,
    exitAnim: Int,
    backgroundColor: Int
)

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
open Unit
open Unit
open Boolean
Unit

This function is deprecated. Deprecated in Java

open DragAndDropPermissions
open Unit
requestFullscreenMode(
    request: Int,
    approvalCallback: OutcomeReceiver<VoidThrowable>?
)
Unit
Unit
requestPermissions(permissions: Array<String>, requestCode: Int)
Unit
requestPermissions(
    permissions: Array<String>,
    requestCode: Int,
    deviceId: Int
)
Unit
open Boolean

This function is deprecated. Deprecated in Java

Boolean
T
<T : View> requireViewById(id: Int)
Unit
open Unit
setActionBar(toolbar: Toolbar?)
open Unit
Unit
open Unit
open Unit
Unit
setFeatureDrawable(featureId: Int, drawable: Drawable)
Unit
setFeatureDrawableAlpha(featureId: Int, alpha: Int)
Unit
setFeatureDrawableResource(featureId: Int, resId: Int)
Unit
setFeatureDrawableUri(featureId: Int, uri: Uri)
open Unit
open Unit
setInheritShowWhenLocked(inheritShowWhenLocked: Boolean)
open Unit
setLocusContext(locusId: LocusId?, bundle: Bundle?)
open Unit
Unit
setProgress(progress: Int)

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

Unit

This function is deprecated. Deprecated in Java

open Unit
Unit
setResult(resultCode: Int)
Unit
setResult(resultCode: Int, data: Intent)
Unit
setSecondaryProgress(secondaryProgress: Int)

This function is deprecated. Deprecated in Java

open Unit
setShouldDockBigOverlays(shouldDockBigOverlays: Boolean)
open Unit
setShowWhenLocked(showWhenLocked: Boolean)
open Unit
open Boolean
setTranslucent(translucent: Boolean)
open Unit
setTurnScreenOn(turnScreenOn: Boolean)
open Unit
setVisible(visible: Boolean)
open Unit
setVrModeEnabled(enabled: Boolean, requestedComponent: ComponentName)
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
Unit

This function is deprecated. Deprecated in Java

Boolean
showDialog(id: Int, args: Bundle)

This function is deprecated. Deprecated in Java

open Unit
open ActionMode?
open ActionMode?
open Unit
startActivityFromChild(child: Activity, intent: Intent, requestCode: Int)

This function is deprecated. Deprecated in Java

open Unit
startActivityFromChild(
    child: Activity,
    intent: Intent,
    requestCode: Int,
    options: Bundle?
)

This function is deprecated. Deprecated in Java

open Unit
startActivityFromFragment(
    fragment: Fragment,
    intent: Intent,
    requestCode: Int
)

This function is deprecated. Deprecated in Java

open Unit
startActivityFromFragment(
    fragment: Fragment,
    intent: Intent,
    requestCode: Int,
    options: Bundle?
)

This function is deprecated. Deprecated in Java

open Boolean
startActivityIfNeeded(intent: Intent, requestCode: Int)
open Boolean
startActivityIfNeeded(intent: Intent, requestCode: Int, options: Bundle?)
open Unit
startIntentSenderFromChild(
    child: Activity,
    intent: IntentSender,
    requestCode: Int,
    fillInIntent: Intent,
    flagsMask: Int,
    flagsValues: Int,
    extraFlags: Int
)

This function is deprecated. Deprecated in Java

open Unit
startIntentSenderFromChild(
    child: Activity,
    intent: IntentSender,
    requestCode: Int,
    fillInIntent: Intent,
    flagsMask: Int,
    flagsValues: Int,
    extraFlags: Int,
    options: Bundle?
)

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Boolean
open Boolean
startNextMatchingActivity(intent: Intent, options: Bundle?)
open Unit
open Unit
startSearch(
    initialQuery: String?,
    selectInitialQuery: Boolean,
    appSearchData: Bundle?,
    globalSearch: Boolean
)
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
triggerSearch(query: String, appSearchData: Bundle?)
open Unit
open Unit
open Unit
From android.content.ComponentCallbacks
open Unit
From android.content.Context
open Boolean
bindIsolatedService(
    service: Intent,
    flags: Context.BindServiceFlags,
    instanceName: String,
    executor: Executor,
    conn: ServiceConnection
)
open Boolean
bindIsolatedService(
    service: Intent,
    flags: Int,
    instanceName: String,
    executor: Executor,
    conn: ServiceConnection
)
open Boolean
bindService(
    service: Intent,
    conn: ServiceConnection,
    flags: Context.BindServiceFlags
)
open Boolean
bindService(service: Intent, conn: ServiceConnection, flags: Int)
open Boolean
bindService(
    service: Intent,
    flags: Context.BindServiceFlags,
    executor: Executor,
    conn: ServiceConnection
)
open Boolean
bindService(
    service: Intent,
    flags: Int,
    executor: Executor,
    conn: ServiceConnection
)
open Boolean
bindServiceAsUser(
    service: Intent,
    conn: ServiceConnection,
    flags: Context.BindServiceFlags,
    user: UserHandle
)
open Boolean
bindServiceAsUser(
    service: Intent,
    conn: ServiceConnection,
    flags: Int,
    user: UserHandle
)
open Int
open Int
open IntArray
open Int
open Int
checkCallingUriPermission(uri: Uri, modeFlags: Int)
open IntArray
open Int
checkContentUriPermissionFull(uri: Uri, pid: Int, uid: Int, modeFlags: Int)
open Int
checkPermission(permission: String, pid: Int, uid: Int)
open Int
open Int
checkUriPermission(uri: Uri, pid: Int, uid: Int, modeFlags: Int)
open Int
checkUriPermission(
    uri: Uri?,
    readPermission: String?,
    writePermission: String?,
    pid: Int,
    uid: Int,
    modeFlags: Int
)
open IntArray
checkUriPermissions(
    uris: MutableList<Uri>,
    pid: Int,
    uid: Int,
    modeFlags: Int
)
open Unit

This function is deprecated. Deprecated in Java

open Context
createAttributionContext(attributionTag: String?)
open Context
createConfigurationContext(overrideConfiguration: Configuration)
open Context
createContext(contextParams: ContextParams)
open Context
open Context
open Context
open Context
open Context
createPackageContext(packageName: String, flags: Int)
open Context
createWindowContext(type: Int, options: Bundle?)
open Context
createWindowContext(display: Display, type: Int, options: Bundle?)
open Array<String>
open Boolean
open Boolean
open Boolean
open Unit
enforceCallingOrSelfPermission(permission: String, message: String?)
open Unit
enforceCallingOrSelfUriPermission(
    uri: Uri,
    modeFlags: Int,
    message: String
)
open Unit
enforceCallingPermission(permission: String, message: String?)
open Unit
enforceCallingUriPermission(uri: Uri, modeFlags: Int, message: String)
open Unit
enforcePermission(permission: String, pid: Int, uid: Int, message: String?)
open Unit
enforceUriPermission(
    uri: Uri,
    pid: Int,
    uid: Int,
    modeFlags: Int,
    message: String
)
open Unit
enforceUriPermission(
    uri: Uri?,
    readPermission: String?,
    writePermission: String?,
    pid: Int,
    uid: Int,
    modeFlags: Int,
    message: String?
)
open Array<String>
Int
ColorStateList
open File
open File
getDir(name: String, mode: Int)
Drawable?
open File?
open Array<File>
open File
open SharedPreferences
String
getString(resId: Int)
String
getString(resId: Int, vararg formatArgs: Any)
open Any
T
<T : Any> getSystemService(serviceClass: Class<T>)
open String?
getSystemServiceName(serviceClass: Class<*>)
CharSequence
getText(resId: Int)
open Unit
grantUriPermission(toPackage: String, uri: Uri, modeFlags: Int)
open Boolean
moveDatabaseFrom(sourceContext: Context, name: String)
open Boolean
moveSharedPreferencesFrom(sourceContext: Context, name: String)
TypedArray
TypedArray
TypedArray
TypedArray
obtainStyledAttributes(
    set: AttributeSet?,
    attrs: IntArray,
    defStyleAttr: Int,
    defStyleRes: Int
)
open FileInputStream
open FileOutputStream
openFileOutput(name: String, mode: Int)
open SQLiteDatabase
openOrCreateDatabase(
    name: String,
    mode: Int,
    factory: SQLiteDatabase.CursorFactory
)
open SQLiteDatabase
openOrCreateDatabase(
    name: String,
    mode: Int,
    factory: SQLiteDatabase.CursorFactory,
    errorHandler: DatabaseErrorHandler?
)
open Drawable

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Intent?
open Intent?
registerReceiver(
    receiver: BroadcastReceiver?,
    filter: IntentFilter,
    flags: Int
)
open Intent?
registerReceiver(
    receiver: BroadcastReceiver?,
    filter: IntentFilter,
    broadcastPermission: String?,
    scheduler: Handler?
)
open Intent?
registerReceiver(
    receiver: BroadcastReceiver?,
    filter: IntentFilter,
    broadcastPermission: String?,
    scheduler: Handler?,
    flags: Int
)
open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
revokeUriPermission(uri: Uri, modeFlags: Int)
open Unit
revokeUriPermission(targetPackage: String, uri: Uri, modeFlags: Int)
open Unit
open Unit
sendBroadcast(intent: Intent, receiverPermission: String?)
open Unit
sendBroadcast(intent: Intent, receiverPermission: String?, options: Bundle?)
open Unit
open Unit
sendBroadcastAsUser(
    intent: Intent,
    user: UserHandle,
    receiverPermission: String?
)
open Unit
sendBroadcastWithMultiplePermissions(
    intent: Intent,
    receiverPermissions: Array<String>
)
open Unit
sendOrderedBroadcast(intent: Intent, receiverPermission: String?)
open Unit
sendOrderedBroadcast(
    intent: Intent,
    receiverPermission: String?,
    options: Bundle?
)
open Unit
sendOrderedBroadcast(
    intent: Intent,
    receiverPermission: String?,
    resultReceiver: BroadcastReceiver?,
    scheduler: Handler?,
    initialCode: Int,
    initialData: String?,
    initialExtras: Bundle?
)
open Unit
sendOrderedBroadcast(
    intent: Intent,
    receiverPermission: String?,
    options: Bundle?,
    resultReceiver: BroadcastReceiver?,
    scheduler: Handler?,
    initialCode: Int,
    initialData: String?,
    initialExtras: Bundle?
)
open Unit
sendOrderedBroadcast(
    intent: Intent,
    receiverPermission: String?,
    receiverAppOp: String?,
    resultReceiver: BroadcastReceiver?,
    scheduler: Handler?,
    initialCode: Int,
    initialData: String?,
    initialExtras: Bundle?
)
open Unit
sendOrderedBroadcastAsUser(
    intent: Intent,
    user: UserHandle,
    receiverPermission: String?,
    resultReceiver: BroadcastReceiver?,
    scheduler: Handler?,
    initialCode: Int,
    initialData: String?,
    initialExtras: Bundle?
)
open Unit

This function is deprecated. Deprecated in Java

open Unit
sendStickyBroadcast(intent: Intent, options: Bundle?)

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit
sendStickyOrderedBroadcast(
    intent: Intent,
    resultReceiver: BroadcastReceiver?,
    scheduler: Handler?,
    initialCode: Int,
    initialData: String?,
    initialExtras: Bundle?
)

This function is deprecated. Deprecated in Java

open Unit
sendStickyOrderedBroadcastAsUser(
    intent: Intent,
    user: UserHandle,
    resultReceiver: BroadcastReceiver?,
    scheduler: Handler?,
    initialCode: Int,
    initialData: String?,
    initialExtras: Bundle?
)

This function is deprecated. Deprecated in Java

open Unit
setTheme(resid: Int)
open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
startActivities(intents: Array<Intent>, options: Bundle?)
open Unit
open Unit
startActivity(intent: Intent, options: Bundle?)
open ComponentName?
open Boolean
startInstrumentation(
    className: ComponentName,
    profileFile: String?,
    arguments: Bundle?
)
open Unit
startIntentSender(
    intent: IntentSender,
    fillInIntent: Intent?,
    flagsMask: Int,
    flagsValues: Int,
    extraFlags: Int
)
open Unit
startIntentSender(
    intent: IntentSender,
    fillInIntent: Intent?,
    flagsMask: Int,
    flagsValues: Int,
    extraFlags: Int,
    options: Bundle?
)
open ComponentName?
startService(service: Intent)
open Boolean
open Unit
open Unit
open Unit
open Unit
open Unit
updateServiceGroup(conn: ServiceConnection, group: Int, importance: Int)
From android.view.ContextThemeWrapper
open Unit
applyOverrideConfiguration(overrideConfiguration: Configuration)
open Unit
onApplyThemeResource(theme: Resources.Theme, resid: Int, first: Boolean)
From android.content.ContextWrapper
open Unit
open Unit
sendOrderedBroadcast(
    intent: Intent,
    initialCode: Int,
    receiverPermission: String?,
    receiverAppOp: String?,
    resultReceiver: BroadcastReceiver?,
    scheduler: Handler?,
    initialData: String?,
    initialExtras: Bundle?,
    options: Bundle?
)
From android.view.KeyEvent.Callback
open Boolean
onKeyDown(keyCode: Int, event: KeyEvent)
open Boolean
onKeyLongPress(keyCode: Int, event: KeyEvent)
open Boolean
onKeyMultiple(keyCode: Int, repeatCount: Int, event: KeyEvent)
open Boolean
onKeyUp(keyCode: Int, event: KeyEvent)
From android.view.LayoutInflater.Factory
open View?
onCreateView(name: String, context: Context, attrs: AttributeSet)
From android.view.LayoutInflater.Factory2
open View?
onCreateView(
    parent: View?,
    name: String,
    context: Context,
    attrs: AttributeSet
)
From android.view.View.OnCreateContextMenuListener
open Unit
onCreateContextMenu(
    menu: ContextMenu,
    v: View,
    menuInfo: ContextMenu.ContextMenuInfo
)
From android.view.Window.Callback

Inherited properties

From android.app.Activity
open ActionBar?
Application
open ComponentCaller?
open ComponentName?
open String?
open Int
open ComponentName
open Scene
open TransitionManager
open ComponentCaller
open View?
open FragmentManager
open ComponentCaller
open Intent
open Boolean
open Boolean
Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Any?
open String?
open Int
open LayoutInflater
open LoaderManager
open String
open Int
MediaController
open MenuInflater
open OnBackInvokedDispatcher
Activity
open Intent?
open Uri?
open Int
SearchEvent
SplashScreen
open Int
CharSequence
Int
open VoiceInteractor
Int
open Window
open WindowManager
From android.view.ContextThemeWrapper
From android.content.ContextWrapper

Public constructors

ComponentActivity

Added in 1.0.0
ComponentActivity()

ComponentActivity

Added in 1.0.0
@ContentView
ComponentActivity(contentLayoutId: @LayoutRes Int)

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 android.app.AppComponentFactory.

Public functions

addContentView

open fun addContentView(view: View?, params: ViewGroup.LayoutParams?): Unit

addMenuProvider

Added in 1.4.0
open fun addMenuProvider(provider: MenuProvider): Unit

Adds the given MenuProvider to this MenuHost. If using this method, you must manually remove the provider when necessary.

Parameters
provider: MenuProvider

the MenuProvider to be added

addMenuProvider

Added in 1.4.0
open fun addMenuProvider(provider: MenuProvider, owner: LifecycleOwner): Unit

Adds the given MenuProvider to this MenuHost. This MenuProvider will be removed once the given LifecycleOwner receives an Lifecycle.Event.ON_DESTROY event.

Parameters
provider: MenuProvider

the MenuProvider to be added

owner: LifecycleOwner

the Lifecycle owner whose state will determine the removal of the provider

addMenuProvider

Added in 1.4.0
open fun addMenuProvider(
    provider: MenuProvider,
    owner: LifecycleOwner,
    state: Lifecycle.State
): Unit

Adds the given MenuProvider to this MenuHost once the given LifecycleOwner reaches the given Lifecycle.State. This MenuProvider will be removed once the given LifecycleOwner goes down from the given Lifecycle.State.

Parameters
provider: MenuProvider

the MenuProvider to be added

owner: LifecycleOwner

the Lifecycle owner whose state will be used for automated addition/removal

state: Lifecycle.State

the Lifecycle.State to check for automated addition/removal

addOnConfigurationChangedListener

Added in 1.5.0
final fun addOnConfigurationChangedListener(listener: Consumer<Configuration>): Unit

Add a new listener that will get a callback associated with ComponentCallbacks.onConfigurationChanged with the new Configuration.

Parameters
listener: Consumer<Configuration>

The listener that should be called whenever {ComponentCallbacks.onConfigurationChanged was called.

addOnContextAvailableListener

final fun addOnContextAvailableListener(listener: OnContextAvailableListener): Unit

{@inheritDoc}

Any listener added here will receive a callback as part of super.onCreate(), but importantly before any other logic is done (including calling through to the framework Activity.onCreate with the exception of restoring the state of the savedStateRegistry for use in your listener.

addOnMultiWindowModeChangedListener

Added in 1.5.0
final fun addOnMultiWindowModeChangedListener(
    listener: Consumer<MultiWindowModeChangedInfo>
): Unit

Add a new listener that will get a callback associated with Activity.onMultiWindowModeChanged with the new MultiWindowModeChangedInfo.

Parameters
listener: Consumer<MultiWindowModeChangedInfo>

The listener that should be called whenever Activity#onMultiWindowModeChanged was called.

addOnNewIntentListener

Added in 1.5.0
final fun addOnNewIntentListener(listener: Consumer<Intent>): Unit

Add a new listener that will get a callback associated with Activity.onNewIntent with the new Intent.

Parameters
listener: Consumer<Intent>

The listener that should be called whenever android.app.Activity#onNewIntent was called.

addOnPictureInPictureModeChangedListener

Added in 1.5.0
final fun addOnPictureInPictureModeChangedListener(
    listener: Consumer<PictureInPictureModeChangedInfo>
): Unit

Add a new listener that will get a callback associated with Activity.onPictureInPictureModeChanged with the new PictureInPictureModeChangedInfo.

Parameters
listener: Consumer<PictureInPictureModeChangedInfo>

The listener that should be called whenever Activity.onPictureInPictureModeChanged was called.

addOnPictureInPictureUiStateChangedListener

final fun addOnPictureInPictureUiStateChangedListener(
    listener: Consumer<PictureInPictureUiStateCompat>
): Unit

Add a new listener that will get a callback associated with Activity.onPictureInPictureUiStateChanged with the new PictureInPictureUiStateCompat.

Parameters
listener: Consumer<PictureInPictureUiStateCompat>

The listener that should be called whenever Activity.onPictureInPictureUiStateChanged was called.

addOnTrimMemoryListener

Added in 1.5.0
final fun addOnTrimMemoryListener(listener: Consumer<Int>): Unit

Add a new listener that will get a callback associated with ComponentCallbacks2.onTrimMemory with the int representing the level of trimming.

Parameters
listener: Consumer<Int>

The listener that should be called whenever ComponentCallbacks2.onTrimMemory was called.

addOnUserLeaveHintListener

Added in 1.9.0
final fun addOnUserLeaveHintListener(listener: Runnable): Unit

Add a new listener that will get a callback associated with Activity.onUserLeaveHint

Parameters
listener: Runnable

The listener that should be called whenever Activity.onUserLeaveHint was called.

enterPictureInPictureMode

final fun enterPictureInPictureMode(params: PictureInPictureParamsCompat): Unit

Available since API 24 in the framework Activity class, puts the activity in picture-in-picture mode if possible in the current system state. Any prior calls to setPictureInPictureParams will still apply when entering picture-in-picture through this call.

initializeViewTreeOwners

Added in 1.8.0
@CallSuper
open fun initializeViewTreeOwners(): Unit

Sets the view tree owners before setting the content view so that the inflation process and attach listeners will see them already present.

invalidateMenu

Added in 1.4.0
open fun invalidateMenu(): Unit

Invalidates the android.view.Menu to ensure that what is displayed matches the current internal state of the menu. This should be called whenever the state of the menu is changed, such as items being removed or disabled based on some user event.

onBackPressed

Added in 1.6.0
@MainThread
@CallSuper
open fun onBackPressed(): Unit

Called when the activity has detected the user's press of the back key. The onBackPressedDispatcher will be given a chance to handle the back button before the default behavior of android.app.Activity.onBackPressed is invoked.

onConfigurationChanged

@CallSuper
open fun onConfigurationChanged(newConfig: Configuration): Unit

{@inheritDoc}

Dispatches this call to all listeners added via addOnConfigurationChangedListener.

onCreatePanelMenu

open fun onCreatePanelMenu(featureId: Int, menu: Menu): Boolean

onMenuItemSelected

open fun onMenuItemSelected(featureId: Int, item: MenuItem): Boolean

onMultiWindowModeChanged

Added in 1.5.0
@CallSuper
open fun onMultiWindowModeChanged(isInMultiWindowMode: Boolean): Unit

{@inheritDoc}

Dispatches this call to all listeners added via addOnMultiWindowModeChangedListener.

onMultiWindowModeChanged

@RequiresApi(api = 26)
@CallSuper
open fun onMultiWindowModeChanged(
    isInMultiWindowMode: Boolean,
    newConfig: Configuration
): Unit

{@inheritDoc}

Dispatches this call to all listeners added via addOnMultiWindowModeChangedListener.

onPanelClosed

open fun onPanelClosed(featureId: Int, menu: Menu): Unit

onPictureInPictureModeChanged

Added in 1.5.0
@CallSuper
open fun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean): Unit

{@inheritDoc}

Dispatches this call to all listeners added via addOnPictureInPictureModeChangedListener.

onPictureInPictureModeChanged

@RequiresApi(api = 26)
@CallSuper
open fun onPictureInPictureModeChanged(
    isInPictureInPictureMode: Boolean,
    newConfig: Configuration
): Unit

{@inheritDoc}

Dispatches this call to all listeners added via addOnPictureInPictureModeChangedListener.

onPictureInPictureUiStateChanged

@RequiresApi(api = 31)
@CallSuper
open fun onPictureInPictureUiStateChanged(pipState: PictureInPictureUiState): Unit

{@inheritDoc}

onPreparePanel

open fun onPreparePanel(featureId: Int, view: View?, menu: Menu): Boolean

onRequestPermissionsResult

Added in 1.2.0
Deprecated in 1.2.0
@CallSuper
open fun onRequestPermissionsResult(
    requestCode: Int,
    permissions: Array<String>,
    grantResults: IntArray
): Unit

{@inheritDoc}

onRetainCustomNonConfigurationInstance

Added in 1.0.0
Deprecated in 1.0.0
open fun onRetainCustomNonConfigurationInstance(): Any?

Use this instead of onRetainNonConfigurationInstance. Retrieve later with lastCustomNonConfigurationInstance.

onRetainNonConfigurationInstance

Added in 1.0.0
final fun onRetainNonConfigurationInstance(): Any?

Retain all appropriate non-config state. You can NOT override this yourself! Use a androidx.lifecycle.ViewModel if you want to retain your own non config state.

onTrimMemory

@CallSuper
open fun onTrimMemory(level: Int): Unit

{@inheritDoc}

Dispatches this call to all listeners added via addOnTrimMemoryListener.

peekAvailableContext

open fun peekAvailableContext(): Context?

Get the Context if it is currently available. If this returns null, you can use addOnContextAvailableListener to receive a callback for when it available.

Returns
Context?

the Context if it is currently available.

registerForActivityResult

final fun <I : Any?, O : Any?> registerForActivityResult(
    contract: ActivityResultContract<I, O>,
    callback: ActivityResultCallback<O>
): ActivityResultLauncher<I>

Register a request to start an activity for result, designated by the given contract.

This creates a record in the registry associated with this caller, managing request code, as well as conversions to/from Intent under the hood.

This must be called unconditionally, as part of initialization path, typically as a field initializer of an Activity or Fragment.

Parameters
<I : Any?>

the type of the input(if any) required to call the activity

<O : Any?>

the type of output returned as an activity result

contract: ActivityResultContract<I, O>

the contract, specifying conversions to/from Intents

callback: ActivityResultCallback<O>

the callback to be called on the main thread when activity result is available

Returns
ActivityResultLauncher<I>

the launcher that can be used to start the activity or dispose of the prepared call.

registerForActivityResult

final fun <I : Any?, O : Any?> registerForActivityResult(
    contract: ActivityResultContract<I, O>,
    registry: ActivityResultRegistry,
    callback: ActivityResultCallback<O>
): ActivityResultLauncher<I>

Register a request to start an activity for result, designated by the given contract.

This creates a record in the given registry, managing request code, as well as conversions to/from Intent under the hood.

This must be called unconditionally, as part of initialization path, typically as a field initializer of an Activity or Fragment.

Parameters
<I : Any?>

the type of the input(if any) required to call the activity

<O : Any?>

the type of output returned as an activity result

contract: ActivityResultContract<I, O>

the contract, specifying conversions to/from Intents

registry: ActivityResultRegistry

the registry where to hold the record.

callback: ActivityResultCallback<O>

the callback to be called on the main thread when activity result is available

Returns
ActivityResultLauncher<I>

the launcher that can be used to start the activity or dispose of the prepared call.

removeMenuProvider

Added in 1.4.0
open fun removeMenuProvider(provider: MenuProvider): Unit

Removes the given MenuProvider from this MenuHost.

Parameters
provider: MenuProvider

the MenuProvider to be removed

removeOnConfigurationChangedListener

Added in 1.5.0
final fun removeOnConfigurationChangedListener(listener: Consumer<Configuration>): Unit

Remove a previously added listener. It will not receive any future callbacks.

Parameters
listener: Consumer<Configuration>

The listener previously added with addOnConfigurationChangedListener that should be removed.

removeOnContextAvailableListener

final fun removeOnContextAvailableListener(listener: OnContextAvailableListener): Unit

Remove a OnContextAvailableListener previously added via addOnContextAvailableListener.

Parameters
listener: OnContextAvailableListener

The listener that should be removed.

removeOnMultiWindowModeChangedListener

Added in 1.5.0
final fun removeOnMultiWindowModeChangedListener(
    listener: Consumer<MultiWindowModeChangedInfo>
): Unit

Remove a previously added listener. It will not receive any future callbacks.

Parameters
listener: Consumer<MultiWindowModeChangedInfo>

The listener previously added with addOnMultiWindowModeChangedListener that should be removed.

removeOnNewIntentListener

Added in 1.5.0
final fun removeOnNewIntentListener(listener: Consumer<Intent>): Unit

Remove a previously added listener. It will not receive any future callbacks.

Parameters
listener: Consumer<Intent>

The listener previously added with addOnNewIntentListener that should be removed.

removeOnPictureInPictureModeChangedListener

Added in 1.5.0
final fun removeOnPictureInPictureModeChangedListener(
    listener: Consumer<PictureInPictureModeChangedInfo>
): Unit

Remove a previously added listener. It will not receive any future callbacks.

Parameters
listener: Consumer<PictureInPictureModeChangedInfo>

The listener previously added with addOnPictureInPictureModeChangedListener that should be removed.

removeOnPictureInPictureUiStateChangedListener

final fun removeOnPictureInPictureUiStateChangedListener(
    listener: Consumer<PictureInPictureUiStateCompat>
): Unit

Remove a previously added listener. It will not receive any future callbacks.

Parameters
listener: Consumer<PictureInPictureUiStateCompat>

The listener previously added with addOnPictureInPictureUiStateChangedListener that should be removed.

removeOnTrimMemoryListener

Added in 1.5.0
final fun removeOnTrimMemoryListener(listener: Consumer<Int>): Unit

Remove a previously added listener. It will not receive any future callbacks.

Parameters
listener: Consumer<Int>

The listener previously added with .addOnTrimMemoryListener that should be removed.

removeOnUserLeaveHintListener

Added in 1.9.0
final fun removeOnUserLeaveHintListener(listener: Runnable): Unit

Remove a previously added listener. It will not receive any future callbacks.

Parameters
listener: Runnable

The listener previously added with addOnUserLeaveHintListener that should be removed.

reportFullyDrawn

open fun reportFullyDrawn(): Unit

setContentView

open fun setContentView(layoutResID: @LayoutRes Int): Unit

setContentView

open fun setContentView(view: View?): Unit

setContentView

open fun setContentView(view: View?, params: ViewGroup.LayoutParams?): Unit

setPictureInPictureParams

final fun setPictureInPictureParams(params: PictureInPictureParamsCompat): Unit

Available since API 26 in the framework Activity class, updates the properties of the picture-in-picture activity, or sets it to be used later when enterPictureInPictureMode is called

Parameters
params: PictureInPictureParamsCompat

PictureInPictureParams to use for picture-in-picture mode.

startActivityForResult

Added in 1.2.0
Deprecated in 1.2.0
open fun startActivityForResult(intent: Intent, requestCode: Int): Unit

{@inheritDoc}

startActivityForResult

Added in 1.2.0
Deprecated in 1.2.0
open fun startActivityForResult(intent: Intent, requestCode: Int, options: Bundle?): Unit

{@inheritDoc}

startIntentSenderForResult

Added in 1.2.0
Deprecated in 1.2.0
open fun startIntentSenderForResult(
    intent: IntentSender,
    requestCode: Int,
    fillInIntent: Intent?,
    flagsMask: Int,
    flagsValues: Int,
    extraFlags: Int
): Unit

{@inheritDoc}

startIntentSenderForResult

Added in 1.2.0
Deprecated in 1.2.0
open fun startIntentSenderForResult(
    intent: IntentSender,
    requestCode: Int,
    fillInIntent: Intent?,
    flagsMask: Int,
    flagsValues: Int,
    extraFlags: Int,
    options: Bundle?
): Unit

{@inheritDoc}

Protected functions

onActivityResult

Added in 1.2.0
Deprecated in 1.2.0
@CallSuper
protected open fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?): Unit

{@inheritDoc}

onCreate

protected open fun onCreate(savedInstanceState: Bundle?): Unit

{@inheritDoc}

If your ComponentActivity is annotated with ContentView, this will call setContentView for you.

onNewIntent

@CallSuper
protected open fun onNewIntent(intent: Intent): Unit

{@inheritDoc}

Dispatches this call to all listeners added via addOnNewIntentListener.

onSaveInstanceState

@CallSuper
protected open fun onSaveInstanceState(outState: Bundle): Unit

onUserLeaveHint

@CallSuper
protected open fun onUserLeaveHint(): Unit

{@inheritDoc}

Dispatches this call to all listeners added via addOnUserLeaveHintListener.

Public properties

activityResultRegistry

final val activityResultRegistryActivityResultRegistry

Get the ActivityResultRegistry associated with this activity.

defaultViewModelCreationExtras

open val defaultViewModelCreationExtrasCreationExtras

defaultViewModelProviderFactory

Added in 1.1.0
open val defaultViewModelProviderFactoryViewModelProvider.Factory

fullyDrawnReporter

open val fullyDrawnReporterFullyDrawnReporter

Retrieve the FullyDrawnReporter that should handle the independent parts of the UI that separately report that they are fully drawn.

lastCustomNonConfigurationInstance

Added in 1.0.0
Deprecated in 1.0.0
open val lastCustomNonConfigurationInstanceAny?

lifecycle

Added in 1.0.0
open val lifecycleLifecycle

{@inheritDoc}

Overriding this method is no longer supported and this method will be made final in a future version of ComponentActivity. If you do override this method, you must:

  1. Return an instance of LifecycleRegistry

  2. Lazily initialize your LifecycleRegistry object when this is first called.

Note that this method will be called in the super classes' constructor, before any field initialization or object state creation is complete.

Added in 1.12.0
open val navigationEventDispatcherNavigationEventDispatcher

Lazily provides a NavigationEventDispatcher for back navigation handling, including support for predictive back gestures introduced in Android 13 (API 33+).

This dispatcher acts as the central point for back navigation events. When a navigation event occurs (e.g., a back gesture), it safely invokes ComponentActivity.onBackPressed.

onBackPressedDispatcher

final val onBackPressedDispatcherOnBackPressedDispatcher

Retrieve the OnBackPressedDispatcher that will be triggered when onBackPressed is called.

Returns
OnBackPressedDispatcher

The OnBackPressedDispatcher associated with this ComponentActivity.

savedStateRegistry

Added in 1.0.0
final val savedStateRegistrySavedStateRegistry

viewModelStore

Added in 1.0.0
open val viewModelStoreViewModelStore

Extension functions

@MainThread
inline fun <VM : ViewModel> ComponentActivity.viewModels(
    noinline extrasProducer: (() -> CreationExtras)? = null,
    noinline factoryProducer: (() -> ViewModelProvider.Factory)? = null
): Lazy<VM>

Returns a Lazy delegate to access the ComponentActivity's ViewModel, if factoryProducer is specified then ViewModelProvider.Factory returned by it will be used to create ViewModel first time.

class MyComponentActivity : ComponentActivity() {
val viewmodel: MyViewModel by viewModels()
}

This property can be accessed only after the Activity is attached to the Application, and access prior to that will result in IllegalArgumentException.

fun ComponentActivity.setContent(
    parent: CompositionContext? = null,
    content: @Composable () -> Unit
): Unit

Composes the given composable into the given activity. The content will become the root view of the given activity.

This is roughly equivalent to calling ComponentActivity.setContentView with a ComposeView i.e.:

setContentView(
ComposeView(this).apply {
setContent {
MyComposableContent()
}
}
)
Parameters
parent: CompositionContext? = null

The parent composition reference to coordinate scheduling of composition updates

content: @Composable () -> Unit

A @Composable function declaring the UI contents

enableEdgeToEdge

fun ComponentActivity.enableEdgeToEdge(
    statusBarStyle: SystemBarStyle = SystemBarStyle.auto(Color.TRANSPARENT, Color.TRANSPARENT),
    navigationBarStyle: SystemBarStyle = SystemBarStyle.auto(DefaultLightScrim, DefaultDarkScrim)
): Unit

Enables the edge-to-edge display for this ComponentActivity.

To set it up with the default style, call this method in your Activity's onCreate method:

    override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
...
}

The default style configures the system bars with a transparent background when contrast can be enforced by the system (API 29 or above). On older platforms (which only have 3-button/2-button navigation modes), an equivalent scrim is applied to ensure contrast with the system bars.

See SystemBarStyle for more customization options.

Parameters
statusBarStyle: SystemBarStyle = SystemBarStyle.auto(Color.TRANSPARENT, Color.TRANSPARENT)

The SystemBarStyle for the status bar.

navigationBarStyle: SystemBarStyle = SystemBarStyle.auto(DefaultLightScrim, DefaultDarkScrim)

The SystemBarStyle for the navigation bar.