Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: support package Fragment

Tags:

android

I tried this example

http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentPagerSupport.html

I build for API Level 15 and use support package as well. This funktion causes trouble:

@Override
        public Fragment getItem(int position) {
            return ArrayListFragment.newInstance(position);
        }

Error Message:

The return type is incompatible with FragmentPagerAdapter.getItem(int)

I found a similar problem but with no clear solution to me Cannot convert from android.support.v4.app.Fragment to android.app.Fragment

like image 356
user1324936 Avatar asked Dec 21 '25 05:12

user1324936


1 Answers

Make sure you are using this class: android.support.v4.app.Fragment instead of android.app.Fragment

like image 118
Cristian Avatar answered Dec 22 '25 19:12

Cristian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!