5

I wonder if it is possible to implement swiping between Fragments with ViewPager without the use of android.support.v4? I'm using android.app. Or is there any other way that this can be done?

Thanks

1 Answers1

1

I wonder if it is possible to implement swiping between Fragments with ViewPager without the use of android.support.v4?

If you are looking to use ViewPager with native API Level 11 fragments, use android-support-v13.jar and its implementation of things like ViewPager and FragmentPagerAdapter. You will find both the v4 and the v13 versions of FragmentPagerAdapter in the documentation.

Or, roll your own subclass of PagerAdapter that handles fragments in a way that suits you, along with android-support-v13.jar for ViewPager.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Or you can copy the source code of ViewPager and it's adapters to your project and make some minor modifications to make it run without support library. That's what I did when I wrote an app for API level 16+. – Yaroslav Mytkalyk May 07 '13 at 11:13
  • 1
    @DoctororDrive: That is not necessary; IMHO, it is also not advisable. Now you have to re-do that work every time they ship a new Android Support package, so you pick up any bug fixes. Since ProGuard will strip out unused stuff from your release builds, you should not be saving much, if any, APK space by creating your own separate set of classes. – CommonsWare May 07 '13 at 11:17
  • As far as I know proguard can't remove unsed classes from library jars. – Yaroslav Mytkalyk May 07 '13 at 12:40
  • 1
    @DoctororDrive: And your proof of this is... what, exactly? Note that the author of ProGuard appears to disagree with you: http://stackoverflow.com/a/10992604/115145 – CommonsWare May 07 '13 at 12:42
  • http://stackoverflow.com/questions/8417440/can-proguard-leave-out-the-unused-classes-of-the-libraries – Yaroslav Mytkalyk May 07 '13 at 12:46
  • 1
    @DoctororDrive: As Sean Owen points out in an answer on the question you just linked to, "Proguard can strip out unused classes, including those that you built in from this other library, if you configure it to". And StephenC, in the other answer on the question you linked to, wrote "According to my reading of the manual, ProGuard does leave out unused classes for the JAR files that it process." – CommonsWare May 07 '13 at 12:48
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/29537/discussion-between-doctoror-drive-and-commonsware) – Yaroslav Mytkalyk May 07 '13 at 12:56
  • 1
    @DoctororDrive: No, thank you. If you have further questions on the behavior of ProGuard, ask a fresh StackOverflow question on that topic. – CommonsWare May 07 '13 at 12:57
  • So can I use the package for just this thing, or do I have to change the things when I have used android.app? – user2307292 May 08 '13 at 07:53