Search code examples
androidfragmentback

Which lifecycle called when i am press the back button in fragment


I am using action bar in my application with three action bar tab.The second action bar tab having two fragment(A and B). When i click the A fragment list item it redirect into B fragment and then press the back button from B fragment to A fragment at which life cycle is invoked in A Fragment. let me know thanks...


Solution

  • AFAIK,All backPress events will be received by your fragment Activity , as fragments are just child of it. Put a log in it and just check the result in logcat.

    You can find answer of this kind of questions by trial and error, you will also learn a lot by this kind of methodologies.