Understanding Android Activity Lifecycle
Understanding Android Activity Lifecycle
The Android Activity lifecycle is a sequence of states that an Activity goes through when it is created, paused, resumed, and destroyed. The key methods to handle are:
onCreate()
onStart()
onResume()
onPause()
onStop()
onDestroy()
Each of these methods is called at different stages of the Activity's lifecycle.
Example:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
Comments
Post a Comment