I am following the Android tutorial. Trying to learn how to use a ViewPager. The problem i am running into is that i am not able to pass the FragmentManager
i obtain from Activity
to my custom adapter that extends FragmentStatePagerAdapter
Here is some code.
mAdapter = new MyAdapter(getFragmentManager());
and the adapter snippet.
public static class MyAdapter extends FragmentStatePagerAdapter {
public MyAdapter(FragmentManager fm) {
super(fm);
}
I can see the issue is mainly because FragmentStatePagerAdapter
is in support.v4
and its expecting a support.v4
version of the FragmentManager. So how do i proceed?
@Flash answered this correctly in the comments, but in case others are searching for an answer, the OP needs to extend FragmentActivity instead of Activity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With