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
Post a Comment