There are many states, but in practice you use
onDestroy() most often. The activity goes through the creation flow when starting up and then follows a similar (but reverse) tear down flow when moving to the background.
onCreate() is called, the activity is being created, but not yet visible to the user. You can get references to view elements and configure long running processes.
onStart() is called, the activity is being created and may be visible to the user, but the user won't be able to interact.
onResume() is called, the activity is visible to the user and ready for user input.
onPause() is called, the activity is still partially visible. The user may have been shown a dialog or other item that briefly takes the focus away from the active Activity. It's possible that they may resume the activity shortly, but you should start preparing for the tear down.
onStop() is called, the activity is hidden and may be cleaned up if resources are needed for the new (and currently displayed) activity that a user is interacting with.
onDestroy() is called right before your activity is destroyed.
This can happen either because the activity is finishing (someone called
finish() on it, or because the system is temporarily destroying this instance of the activity to save space. You can distinguish between these two scenarios with the