Trouble implementing getMapAsync in Google Maps

前端 未结 1 366
北海茫月
北海茫月 2020-12-19 16:31

I am trying to put a map with a marker in an activity in an Android app. It compiles and builds fine, but when I try to run the activity the app crashes and I get the messag

1条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-19 17:16

    Your xml is using a MapFragment, not a SupportMapFragment.

    Change your xml to use a SupportMapFragment and it should work:

    
    

    Also, make sure that you're inflating the correct layout in the call to setContentView().

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