Cannot resolve method 'getSupportFragmentManager ( )' inside Fragment

后端 未结 14 725
别跟我提以往
别跟我提以往 2020-12-01 05:16

I found the message Cannot resolve method \'getSupportFragmentManager ( )\' I want to fragment as activity. because I want to use Maps on the tabs swipe.

pub         


        
相关标签:
14条回答
  • 2020-12-01 05:54

    Replace getSupportFragmentManager() with getFragmentManager() if you are working in api 21. OR If your app supports versions of Android older than 3.0, be sure you've set up your Android project with the support library as described in Setting Up a Project to Use a Library and use getSupportFragmentManager() this time.

    0 讨论(0)
  • 2020-12-01 05:55

    Use getActivity().getSupportFragmentManager()

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