Explore tens of thousands of sets crafted by our community.
Android Lifecycle Events
20
Flashcards
0/20
onActivityResult()
Called when an activity you launched exits, giving you the requestCode you started it with, the resultCode it returned, and any additional data from it.
onConfigurationChanged()
Called by the system when the device configuration changes while your activity is running. This can occur for changes such as screen rotation, keyboard availability, or locale changes.
onStop()
Called when the activity is no longer visible to the user. This may occur because it is being destroyed, or because another activity has been resumed and is covering it.
onSaveInstanceState()
Called to retrieve per-instance state from an activity before being killed so that the state can be restored in onCreate() or onRestoreInstanceState()
onTrimMemory()
Called when the system needs to free up memory. There are different levels of trimming, ranging from the system just being polite, to the system about to kill your process.
onRestoreInstanceState()
Called so the activity can restore state from the information contained in the Bundle. Follows onStart() when the activity's instance state is being restored.
onAttachedToWindow()
Called when the view hierarchy of the activity is attached to the window. Can be used to do extra setup after your view hierarchy has been set up.
onRestart()
Called after the activity has been stopped, just prior to it being started again. Always followed by onStart()
onStart()
Called when the activity is becoming visible to the user. It's followed by onResume() if the activity comes to the foreground, or onStop() if it becomes hidden.
onDetachedFromWindow()
Called when the view hierarchy of the activity is detached from the window. Can be used to perform cleanup before the activity's views are removed.
onBackPressed()
Called when the activity has detected the user's press of the back key. The default implementation simply finishes the current activity, but it can be overridden to handle it differently.
onWindowFocusChanged()
Called when the current window of the activity gains or loses focus. This is often used for operations that require an update only when the user is looking at the activity.
onCreate()
Called when the activity is first created. This is where you should do all of your normal static set up: create views, bind data to lists, etc.
onResume()
Called when the activity will start interacting with the user. At this point, the activity is at the top of the activity stack, and captures all user input.
onUserLeaveHint()
Called when the user has pressed the home key. This is used by activities to ensure that there is a proper indication when the user is leaving the activity by their own choice.
onDestroy()
Called before the activity is destroyed. This is the final call that the activity will receive. It's usually implemented to ensure that all resources are released.
onPause()
Called when the system is about to start resuming another activity. It's used to commit unsaved changes to persistent data, stop animations, and other things that may be consuming CPU.
onLowMemory()
Called when the operating system has determined that it is in a low memory situation. You should clear caches and release unnecessary resources.
onUserInteraction()
Called whenever the user touches the screen in an activity. This is often used to reset any timers that would conclude the user has stopped interacting with the application.
onRequestPermissionsResult()
Called when the user responds to permission requests. This method is used to receive the result of those permission requests.
© Hypatia.Tech. 2024 All rights reserved.