android with viewpager When i click on Button in the first fragment I want the app to navigate to another activity -
i have 2 fragments implemented using view pager. in fragment 1 have 2 button , in fragment 2 have list of item.
when click on particular button in first fragment want app navigate activity.
but scenario when click on particular button in first fragment it's click on second fragment list item , open list item detail.
if knows, please suggest me solution. need possible.
thanks
one thing came on top of head this:
- store fragments in viewpager.
- listen button click events in first fragment.
- from first fragment, notify activity of said click event.
- your activity (which houses viewpager) should respond click event commanding viewpager move second page (which contains second fragment). can calling
yourviewpager.setcurrentitem()
.
and there have it. fragment contains button move pager onto next page/fragment.
Comments
Post a Comment