ViewPager in Android - When is the destroyItem(ViewGroup container , int position) method called? -
in viewpager set adapter follows
myviewpageradapter = new myviewpageradapter(); viewpager.setadapter(myviewpageradapter);
this myviewpageradapter class
public class myviewpageradapter extends pageradapter { private layoutinflater layoutinflater; public myviewpageradapter() {} @override public object instantiateitem(viewgroup container, int position) { } @override public int getcount() { } @override public boolean isviewfromobject(view view, object obj) { } @override public void destroyitem(viewgroup container, int position, object object) { } }
what happens when call empty contructor in myviewpageradapter? methods called?
no methods called.
a constructor used create new object of class myviewpageradapter
, because in case it's default constructor (empty body) , can skip writing it.
ref: https://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.8.9
Comments
Post a Comment