ComponentActivity
open class ComponentActivity : ComponentActivity, ContextAware, LifecycleOwner, ViewModelStoreOwner, HasDefaultViewModelProviderFactory, SavedStateRegistryOwner, OnBackPressedDispatcherOwner, ActivityResultRegistryOwner, ActivityResultCaller
androidx.activity.ComponentActivity |
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 | |
---|---|
<init>() Default constructor for ComponentActivity. |
|
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!) |
Unit |
addOnContextAvailableListener(@NonNull listener: OnContextAvailableListener) Add a new |
ActivityResultRegistry |
Get the |
open ViewModelProvider.Factory |
Returns the default |
open Any? |
Return the value previously returned from |
open Lifecycle |
Returns the Lifecycle of the provider. |
OnBackPressedDispatcher |
Retrieve the |
SavedStateRegistry | |
open ViewModelStore |
Returns the |
open Unit |
Called when the activity has detected the user's press of the back key. |
open Unit |
onRequestPermissionsResult(requestCode: Int, @NonNull permissions: Array<String!>, @NonNull grantResults: IntArray) |
open Any? |
Use this instead of |
Any? |
Retain all appropriate non-config state. |
open Context? | |
ActivityResultLauncher<I> |
registerForActivityResult(@NonNull contract: ActivityResultContract<I, O>, @NonNull registry: ActivityResultRegistry, @NonNull callback: ActivityResultCallback<O>) |
ActivityResultLauncher<I> |
registerForActivityResult(@NonNull contract: ActivityResultContract<I, O>, @NonNull callback: ActivityResultCallback<O>) |
Unit |
removeOnContextAvailableListener(@NonNull listener: OnContextAvailableListener) |
open Unit |