سؤال

I'm trying to implement a ViewPager with a FragmentPagerAdapter, where the ViewPager itself is located inside a fragment. I've read in the docs that it should be possible with the newest Support Library and by using nested fragments. Principally I would like the PagerAdapter to use the root fragment's child fragment manager.

So, my project uses ActionBarSherlock and SherlockFragments. As the support lib bundled with ActionBarSherlock didn't include the method getChildFragmentManager() at all, I downloaded the newest support library v4 and placed it in the libs folder of ActionBarSherlock and my project, too. With this change the project compiles okay, but at first run it exits with a NoSuchMethodError regarding getChildFragmentManager(). What am I doing wrong here?

(P.s. I'm testing it with Android 2.2 which is my targeted minimum platform.)

Thanks!

SOLVED: I replaced the support library in my project and in all referenced libraries with the latest version. Then I cleaned my project, however I forgot to clean and rebuild the referenced libraries, too... This led to this peculiar behaviour.

هل كانت مفيدة؟

المحلول 3

SOLVED: I replaced the support library in my project and in all referenced libraries with the latest version. Then I cleaned my project, however I forgot to clean and rebuild the referenced libraries, too... This led to this peculiar behaviour.

نصائح أخرى

Make sure that none of your referenced libraries use Support Library v13. If you do only the v13 library will be used in all your projects referencing the one using v13 and this seems to interfere with the getChildFragmentManager() method. See THIS QUESTION for more info and pay attention to the console print out when doing a Project->Clean on your whole workspace (assuming you are using Eclipse).

I had the same issue as you but it got resolved once I had the v13 library removed from one of the five Libraries referenced.

The only way to fix this, is just updating ActionBarSherlock with the last android-support-v4 library, wich is 19.1. You can get it uploading it from Android Manager. After that recompile the apk with this change and you will get the method.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top