Last active
August 29, 2015 14:06
-
-
Save tkhduracell/634b59b3c0202b2a6955 to your computer and use it in GitHub Desktop.
Debug Android lifecycles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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