android - Where is the best place to invoke removeOnTabSelectedListener -


i using tablayout , according documentation, setontabselectedlistener deprecated , should use addontabselectedlistener(ontabselectedlistener) , removeontabselectedlistener(ontabselectedlistener) instead.

the question : have invoke removeontabselectedlistener(ontabselectedlistener), ondestroy() callback right?

thats right, can remove listener in ondestroy() method or in onpause() method. if that, dont forget add listener in oncreate() or in onresume(). also, must unusual situation, regularly dont have remove listener because when activity destroyed, destroyed well.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -