mapFragment.getMap() returns null
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 exists?! I tried fixing it using executePendingTransactions() but with no success so far. Any ideas how to fix it? Here is the code private GoogleMap map; private SupportMapFragment mapFragment; @Override public void onCreate( Bundle savedInstanceState ) { //... super.onCreate( savedInstanceState ); setContentView( R.layout.screen_mission2 ); GoogleMapOptions mapOptions = new GoogleMapOptions(); mapOptions.mapType(GoogleMap