I am trying to implement viewpagerindicator within my app.
I am using viewpagerindicator lib. and my code is bellow link.
http://pastebin.com/TRUazPmb
I am getting an error,
11-15 13:07:35.145: E/AndroidRuntime(431): Caused by: java.lang.IllegalStateException: ViewPager adapter must implement TitleProvider to be used with TitlePageIndicator.
at ViewPageActivitys line indicator.setViewPager(mPager);
Anybody help me how to solve it?
Thank you
public class ViewPageFragmentAdapter extends FragmentPagerAdapter {
replace this line with
public class ViewPageFragmentAdapter extends FragmentPagerAdapter implements TitleProvider{
You have to implement TitleProvider for your pager adapter if you are using titlePageindicator. you might need to add some functions after implementing this...
to call different children..
@Override
public Fragment getItem(int arg0) {
if (arg0 == 0) {
return new Fragment1();
} else if (arg0 == 1) {
return new Fragment2();
} else if (arg0 == 2){
return new Fragment3();
} else {
return new Fragment0();
}
}
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