5

guys.

I develop an app for Android API 14 and higher but I want to use ViewPager that comes in Android Support Library.

ViewPager needs FragmentPagerAdapter that uses android.support.v4.app.FragmentManager in the constructor. But within my activities I obviously have only android.app.FragmentManager because they extend android.app.Activity (not android.support.v4.app.FragmentActivity).

Is there any way to convert android.app.FragmentManager to android.support.v4.app.FragmentManager?

Extend my activities from FragmentActivity is not an option for me.

Slava
  • 1,225
  • 2
  • 9
  • 9
  • delete the import and press ctrl+shift+o you will get it – Nirmal Sep 27 '13 at 10:13
  • Where will I get it from? – Slava Sep 27 '13 at 10:18
  • go to your activity and delete all the imports from your code and press ctrl+shift+o – Nirmal Sep 27 '13 at 10:20
  • @Nirmal, there's no problem in my imports. The problem is that android.app.Activity has no method getSupportFragmentManager() and I can't pass android.app.FragmentManager as a parameter to FragmentPagerAdapter's constructor. – Slava Sep 27 '13 at 10:25
  • yes exactly that things wont support its only support by fragment – Nirmal Sep 27 '13 at 10:26

1 Answers1

5

You have to use the v13 support library, which includes a ViewPager using a normal FragmentManager :)

AMerle
  • 4,354
  • 1
  • 28
  • 43