Suppose I have added three fragments :
A
, B
and C
in a transaction and I commit the same. After commiting, onResume()
methods for A
, B
and C
are called successively.
Then, further I use replace function to replace it with a new instance of second fragment.
What I observed is:
FragmentA
is destroyed
FragmentC
is destroyed
FragmentB
is calling onStop()
and not onDestroy()
A new instance of FragmentB
is created and its onCreate()
method is called.
My question is why is onDestroy()
for FragmentB
is not called?