20

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.

Blo
  • 11,903
  • 5
  • 45
  • 99
Peter
  • 715
  • 1
  • 12
  • 23

3 Answers3

4

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.

Community
  • 1
  • 1
Qw4z1
  • 3,041
  • 1
  • 24
  • 36
  • Hi! Thank you for your suggestion! However, I'm ONLY using support package v4 in my project and referenced libraries. Anyway your suggestion gave me a clue in finally solving the problem, many thanks for that! – Peter Jan 19 '13 at 17:20
  • @Peter Cool. =) What was the actual problem? – Qw4z1 Jan 20 '13 at 10:55
  • 3
    Hi! The actual problem was that although I changed the library resources in my project and in the referenced libraries as well, I did not clean and recompile all libraries, only my app. I simply forgot about it. And then, although my app compiled successfully, at some point at runtime it did not find the method getChildFragmentManager() because the library I used was still compiled with the previous version of the support package. – Peter Jan 24 '13 at 17:07
0

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.

datienza
  • 251
  • 4
  • 12
0

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.

Peter
  • 715
  • 1
  • 12
  • 23