Ravindra babu Ravindra babu - 1 year ago 65
Android Question

Activity life cycle methods and Application.ActivityLifecycleCallbacks

Two different sets of life cycle methods are available : ActivityLifecycleCallbacks.html and Activity life cycle methods.

If I implement Activity life cycle methods like


Is there any need to implement Callback methods like

onActivityCreated(Activity activity, Bundle savedInstanceState)
onActivityStarted(Activity activity)


Answer Source

No, these are separate things. The Activity.onCreate(), Activity.onStart(), etc. methods are ones you override within your custom Activity implementation to do your application specific work.

The Application.ActivityLifecycleCallbacks are different and can be used for your app to track the coming/going of any Activity within your app. You really have to have some special needs to use this functionality. These are often used in libraries which use singleton instances or other components which need to know if a given Activity has been destroyed. Most apps probably do not need to use these callbacks.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download