Issue
Two different sets of life cycle methods are available : ActivityLifecycleCallbacks.html and Activity life cycle methods.
If I implement Activity life cycle methods like
onCreate()
onStart()
Is there any need to implement Callback methods like
onActivityCreated(Activity activity, Bundle savedInstanceState)
onActivityStarted(Activity activity)
etc?
Solution
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.
Answered By - Larry Schiefer
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.