Reputation: 679
I'm following the page flipping tutorial from the official Android documents here: http://developer.android.com/training/animation/screen-slide.html
When overriding the getItem(int) method, I get this error:
getItem(int) in 'ScreenSlidePagerAdapter class' clashes with getItem(int) in 'android.support.v4.app.FragmentStatePagerAdapter'; attempting to use incompatible return type.
My custom fragment class extends Fragment as in the tutorial.
To make sure I'm doing nothing wrong, I copy and pasted the example code to test it out (changing the names where required).
What am I doing wrong?
Upvotes: 1
Views: 1050
Reputation: 23279
Check your imports, in this method:
public Fragment getItem(int position) {
you are probably returning
android.app.Fragment
when you should be returning
android.support.v4.app.Fragment
At the top of your class if it says:
import android.app.Fragment;
Remove that and make sure it says:
import android.support.v4.app.Fragment;
Upvotes: 5