mapFragment.getMap() returns null

前端 未结 3 790
醉话见心
醉话见心 2020-12-20 19:40

I\'m trying to get a map from a SupportMapFragment but it returns null. From what I read this could be because the fragment is not yet fully displayed and therefore no map e

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-20 20:34

    You have to implement OnMapReadyCallback, define its public void onMapReady(GoogleMap map) and use it to operate on the fragment as stated in the Google API

提交回复
热议问题