As CommonsWare stated in the linked question, the problem only occures when creating the SupportMapFragment
programmatically and not a <fragment>
XML tag.
If created programmatically, the map will be available in the onActivityCreated()
call. So my workaround is the following:
mMapFragment = new SupportMapFragment() {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
GoogleMap map = mMapFragment.getMap();
if (map != null) {
//Your initialization code goes here
}
}
};