getChildFragmentManager() and support libraries

前端 未结 2 1475
粉色の甜心
粉色の甜心 2020-12-15 21:50

I am using the getChildFragmentManager() in an app that is compiling against API level 19, with the minimum SDK set to 14.

getChildFragmentManage

相关标签:
2条回答
  • 2020-12-15 22:34

    You could try the SupportFragmentManager instead:

    yourFragment = (YourFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.playListFragment)
    
    0 讨论(0)
  • 2020-12-15 22:49

    is there any way to get the getChildFragmentManager() method to work on devices pre-API level 17? If so, how?

    Use the backport of fragments from the Android Support package (android-support-v4.jar, android.support.v4.app.Fragment).

    The method does not seem to be included in either the v4 or v13 support libraries.

    Yes, it is, on FragmentActivity, the Activity base class you need to use in order to use the fragments backport.

    It is on the Fragment class from the backport, for managing child fragments of that fragment.

    I have tried clean builds with both v4 and v13 support libraries, but that does not seem to solve the issue.

    Either you did not change to FragmentActivity the Fragment backport, or your support library JARs are old. Here is a sample project demonstrating the use of FragmentActivity the Fragment backport and its getChildFragmentManager().

    0 讨论(0)
提交回复
热议问题