Eclipse does not recognize android.support.v13.app.FragmentActivity, although I have android-support-v13 library

I am struggling with this error and I really cannot get it right. I am trying to import android.support.v13.app.FragmentActivity; to the class, but it gives me an error: import android.support.v13.app.FragmentActivity could not be resolved. I want to mention that I have both v13 and v4 in the libs folder. I used Clean, Android Support Library and Fix Project Properties. The target device is 2.3.3, if that matters. Thanks. I really really hope someone can help me. EDIT: after editing v4, many errors disappear, and I have 2 more. I am very new to android, so if you could explain to me what is wrong here:

private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter { public ScreenSlidePagerAdapter(FragmentManager fm) { super(fm); //Error: The constructor Fragmentstagepageadapter(FragmentManager) is undefined } @Override public **Fragment** getItem(int position) { //And Here: The return type is incompatible return ScreenSlidePageFragment.create(position); } @Override public int getCount() { return NUM_PAGES; } 

}

+4
source share
2 answers

FragmentActivity is part of the v4 folder, though right? v13 simply means that APIs 13 and above will use the classes in this folder. Therefore, although you may have this folder, I am sure that it does not have FragmentActivity :) Change your import to v4, and not to v13.

http://developer.android.com/reference/android/support/v4/app/FragmentActivity.html

So, you know that you cannot use Fragment from the OS, if you use SupportLib, you only need to use fragment classes inside SupportLib. This includes the fragment itself.

http://developer.android.com/reference/android/support/v4/app/Fragment.html vs http://developer.android.com/reference/android/app/Fragment.html .. Basically, that- or inside android.app, which is associated with fragments, cannot be used with your SupportLib classes. They are not the same class hierarchy and are not compatible.

+2
source

This is the answer I gave a very similar question:

Change "import android.support.v13.app.FragmentActivity" to "import android.support.v4.app.FragmentActivity"

For the undefined part, try this syntax:

 public class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter { public ScreenSlidePagerAdapter (android.support.v4.app.FragmentManager fm) { super(fm); } 

and

 @Override public android.support.v4.app.Fragment getItem(int position) { return ScreenSlidePagerAdapter.create(position); } 
+2
source

All Articles