getFragmentManager( ) and support package

2019-08-17 03:28发布

I'm learning to use fragments for build a dynamic application, but I've a problem with the Fragment Manager. When I pass it by the method getFragmentManager( ) is shown a warning because it returns the Fragment Manager of android.app, not from the support library. Do you know how to fix it?

enter image description here

1条回答
看我几分像从前
2楼-- · 2019-08-17 04:04

You should use getSupportFragmentManager() instead of getFragmentManager()

Also, make sure you are extending FragmentActivity and not just Activity.

查看更多
登录 后发表回答