Google Map returning nullpointerexception Google Maps Android V2

前端 未结 3 1739
谎友^
谎友^ 2020-12-06 22:36

I have a google map in a fragment in my application. Funny thing is that the map loads, but the logcat displays a NullPointerException

3条回答
  •  清歌不尽
    2020-12-06 23:12

    googleMap = ((SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map)).getMap();
    

    This worked for me. getSupportFragmentManager() seemed to be causing all the crashes.

提交回复
热议问题