Change viewpager fragment by a buttonClick
I'm trying to change the viewpager fragment by clicking on a button. I have 5 fragments, each fragment has it's own xml file (frag1.xml, frag2.xml, and so on). Every fragment has it's 5 buttons that should go to other pages of the viewpager. But the problem is how do I check in the FragmentPageAdapter which button is clicked and how to get there? I'll show the code I have then it should be clear I think. Think of it like a homescreen that has dots at the bottom and I you click a certain dot, you'll go to the corresponding screen. FragmentPagerAdapter public class MyFragmentPagerAdapter extends