android - Fragment's onDestroyView not called on back button press -


i have 3 fragments in application: fragment a, b , c.

steps:

  1. i replacing b , keeping in backstack.
  2. i replacing b c , not keeping b in backstack.
  3. 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

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -