Issue
According to official docs, the onStart()
method of an activity should be called after onStop()
.
I have two activities A(HomeScreen) and B(ChatScreen). B starts from activity A using intent. When I press the back button, activity A is called, but the behavior logged in logcat regarding lifecycle doesn't matches the one specified in docs.
This is the behavior when I press back button.
04-02 05:38:56.963 17694-17694/com.example.akash.chatapplication I/System.out﹕ ChatScreen.onPause
04-02 05:38:56.983 17694-17694/com.example.akash.chatapplication I/System.out﹕ HomeScreen.onStart
//Lines not belonging to lifecycle
04-02 05:38:56.983 17694-17694/com.example.akash.chatapplication I/System.out﹕ HomeScreen.onResume
//Lines not belonging to lifecycle
04-02 05:38:57.463 17694-17694/com.example.akash.chatapplication I/System.out﹕ ChatScreen.onStop
04-02 05:38:57.463 17694-17694/com.example.akash.chatapplication I/System.out﹕ ChatScreen.onDestroy
04-02 05:38:57.468 17694-17694/com.example.akash.chatapplication D/AbsListView﹕ onDetachedFromWindow
Notice the first two lines? Why is it happening?
Solution
It is correct, the lifecycle is independent in each activity
Answered By - ARP
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.