Search code examples
androidandroid-dialogfragment

getChildFragmentManager() in android.app.DialogFragment


The minSDK in my app is 16.

I use Fragments and read a lot about the difference between android.app.Fragment and android.support.v4.app.Fragment. The explanation in most answers was, that if I will support devices below 11, I have to use the support libraries. My minSDK is 16, so I decided to use android.app libraries for all my Fragments and FragmentManagers.

Now I need nestedFragments and for that I need getChildFragmentManager() in a DialogFragment... getChildFragmentManager on native Fragment library requires api 17. The solution on similar questions is to use to use the fragments backport from the support-v4 of the Android Support package.

I'm confused. Do I have to change all used Fragments and FragmentManager in my app to the support package? What about the recommendation to use support packages only on minSDKs below 11? Can anyone please explain it?

Thanks a lot!


Solution

  • Yes you need to do any one of these

    1. Use support library to use getChildFragmentManager() provided dialog is also from support library.
    2. Use android.app library and change the api level to 17.

    Also, this link is useful