android - Fragment's onDestroyView not called on back button press -
i have 3 fragments in application: fragment a, b , c.
steps:
- i replacing b , keeping in backstack.
- i replacing b c , not keeping b in backstack.
- i pressing button, on pressing button a's oncreateview , onstart called (as on stack)
the problem fragment c's onstop, ondestroyview etc not called , fragment not visible on screen , fragment c visible (as it;s view not destroyed).
i believe there misunderstanding of stack. when replace b, put transaction a->b in stack, not fragment. stack knows when user presses button, have rollback transaction: destroy b , recreate a. in case, replacing c b , you're pressing button: recreated , b cannot destroyed since doesn't exist. maybe can find solution listening stack events using fragmentmanager.addonbackstackchangedlistener()
, don't know if fits requirement.
Comments
Post a Comment