Skip to content

Instantly share code, notes, and snippets.

@tkhduracell
Last active August 29, 2015 14:06
Show Gist options
  • Save tkhduracell/634b59b3c0202b2a6955 to your computer and use it in GitHub Desktop.
Save tkhduracell/634b59b3c0202b2a6955 to your computer and use it in GitHub Desktop.
Debug Android lifecycles
/**
* getApplication().registerActivityLifecycleCallbacks(new LifeCycleDebugger());
*/
public class LifeCycleDebugger implements Application.ActivityLifecycleCallbacks {
@Override
public void onActivityStopped(Activity activity) {
Log.i(activity.getLocalClassName(), "onActivityStopped");
}
@Override
public void onActivityStarted(Activity activity) {
Log.i(activity.getLocalClassName(), "onActivityStarted");
}
@Override
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
Log.i(activity.getLocalClassName(), "onActivitySaveInstanceState("+outState);
}
@Override
public void onActivityResumed(Activity activity) {
Log.i(activity.getLocalClassName(), "onActivityResumed");
}
@Override
public void onActivityPaused(Activity activity) {
Log.i(activity.getLocalClassName(), "onActivityPaused");
}
@Override
public void onActivityDestroyed(Activity activity) {
Log.i(activity.getLocalClassName(), "onActivityDestroyed");
}
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
Log.i(activity.getLocalClassName(), "onActivityCreated("+savedInstanceState);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment