Cannot resolve method 'getSupportFragmentManager ( )' inside Fragment

后端 未结 14 752
别跟我提以往
别跟我提以往 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:35

    As per the documentation, getSupportFragmentManager() is present only inside AppCompatActivity class. It is not present inside Activity class. So make sure your class extends AppCompatActivity class.

    public class MainActivity extends AppCompatActivity {
    }
    

提交回复
热议问题