Activity states

An activity represents a single screen in your app with an interface the user can interact with. For example, an email app might have one activity that shows a list of new emails, another activity to compose an email, and another activity for reading individual messages.

Create

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // The activity is being created.
}

Start

@Override
protected void onStart() {
    super.onStart();
    // The activity is about to become visible.
}

Resume

@Override
protected void onResume() {
    super.onResume();
    // The activity has become visible (it is now "resumed").
}

Pause

@Override
protected void onPause() {
    super.onPause();
    // Another activity is taking focus 
    // (this activity is about to be "paused").
}

Stop

@Override
protected void onStop() {
    super.onStop();
    // The activity is no longer visible (it is now "stopped")
}

Destroy

@Override
protected void onDestroy() {
    super.onDestroy();
    // The activity is about to be destroyed.
}

Restart

@Override
protected void onRestart() {
    super.onRestart();
    // The activity is about to be restarted.
}

Last updated