[Solved] setAdapter View Pager in a fragment


Convert

mPager.setAdapter(new MyAdapter(Beranda.this, XMENArray));

to

mPager.setAdapter(new MyAdapter(getActivity(), XMENArray));

See, the problem is that your class extends Fragment and you can not pass fragment class instance to the context. So you have to pass context of Activity in which you are using this fragment.

1

solved setAdapter View Pager in a fragment