android - I am not able to find callback in first two fragments of viewpager in activity -
scenario: have 3 fragments in viewpager in activity.
fragment one
fragmenttwo
fragmentthree
i noticed switching fragment 1 3 onpause() method called when switched fragment 1 2 onpause not called
problem: want show data in fragmentone's textview webservice on button click.i clicked button , data shown noticed when switch 1 2 , come fragment 1 data shown. want hide data when come one. there callback . ?
you need understand viewpager first. viewpager creates fragment in advance before , keeps there smooth flow when switch, if on fragment 2. viewpager creates 1 , 3 , keeps.
and when on fragment 3 retains fragment 1. anyways can increase limit of viewpager this
viewpager.setoffscreenpagelimit(int num)
you can understand lifecylce of fragment in viewpager putting logs in onpause , onresume in viewpager fragments.
anyways coming prob. need have custom interface this . answer helped me too
Comments
Post a Comment