6

I need to use nested fragments for my application and so I'd like to use getChildFragmentManager.

I have two devices:

  • A real one running on 4.0.3
  • A virtual one running on 4.2.2

It works pretty well on the second one but not on my physical device since the call to this method raise a NoSuchMethod exception.

07-10 19:53:51.722: E/AndroidRuntime(29711): java.lang.NoSuchMethodError: fr.epitech.test_esi.fragments.ReservationCalendarFragment.getChildFragmentManager

My project use a referenced library so I have downloaded the latest android support library (from SDK manager) and I have added it to both the library and the main project.

Projects view in Eclipse

Also I decided to set the minimum sdk version supported to 4.0.3 (the version my real device is running on):

<uses-sdk
    android:minSdkVersion="15"
    android:targetSdkVersion="17" />

For both the main project and library.

If anyone has an idea of what I could do wrong, let me know.

Blo
  • 11,903
  • 5
  • 45
  • 99
nathan
  • 1,111
  • 3
  • 18
  • 33

2 Answers2

10

getChildFragmentManager() is only available via the Android Support package's backport of fragments, or on API Level 17+ for native fragments. Hence, if you are trying to use native fragments on API Level 15 or 16, and you are also trying to use getChildFragmentManager(), you will get this error.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thanks. Having to use Fragment from backport lib is a problem unless there is a way to them with TabListener? – nathan Jul 10 '13 at 18:37
  • @nathan: `TabListener` is not tied to any sort of fragment, let alone the native one. You *happen* to be provided a `FragmentTransaction` that you can use, one for native API Level 11 fragments. You do not have to use that `FragmentTransaction`. You are welcome to use your own `FragmentTransaction` from the backport, or do something else that does not involve fragments at all. – CommonsWare Jul 10 '13 at 18:38
  • Oh this explains it. I just changed all support fragments to native cause i wouldn't be supporting ICS anymore, and well, seems like I'll still have to use support <_ – Christopher Francisco May 15 '14 at 16:40
0

try use android.support.v4.app.Fragment instead

ray
  • 51
  • 7