Skip to content

Instantly share code, notes, and snippets.

@cgonzalezdai
Last active September 8, 2015 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgonzalezdai/997eed1a8886175111f3 to your computer and use it in GitHub Desktop.
Save cgonzalezdai/997eed1a8886175111f3 to your computer and use it in GitHub Desktop.
Implementing the lifecycle callbacks
// code from http://developer.android.com/guide/components/activities.html#ImplementingLifecycleCallbacks
public class ExampleActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// The activity is being created.
}
@Override
protected void onStart() {
super.onStart();
// The activity is about to become visible.
}
@Override
protected void onResume() {
super.onResume();
// The activity has become visible (it is now "resumed").
}
@Override
protected void onPause() {
super.onPause();
// Another activity is taking focus (this activity is about to be "paused").
}
@Override
protected void onStop() {
super.onStop();
// The activity is no longer visible (it is now "stopped")
}
@Override
protected void onDestroy() {
super.onDestroy();
// The activity is about to be destroyed.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment