android - Event on fragment replace? -


i saw when execute

fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction(); myfragment myfragment = new myfragment(); fragmenttransaction.replace(r.id.parent, myfragment, "myfragment"); fragmenttransaction.addtobackstack(null); fragmenttransaction.commit(); 

there no method called on old fragment. tried with:

  • onstop();
  • onpause();
  • ondestroy();
  • ondetach();

no 1 called, why?

maybe there typing error in post or big misunderstanding. first there no fragmentmanager.replace(), perhaps meant fragmenttransaction.replace().

if so, try ondetach() , ondestroy() again. example, make sure have @override attribute:

@override public void ondetach() { ... } 

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 -