2016-08-24 3 views
1
private void setUpMapIfNeeded() { 
    // Do a null check to confirm that we have not already instantiated the map. 
    if (mMap == null) { 
     // Try to obtain the map from the SupportMapFragment. 
     mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)) 
       .getMap(); 
     // Check if we were successful in obtaining the map. 
     if (mMap != null) { 
      setUpMap(); 
     } 
    } 
} 

«По какой-то странной причине область, в которой говорится .getmap(), не работает, может кто-нибудь помочь».Пытаться сделать карту

ответ

0

Попробуйте удалить часть .getmap() и поместив getMapAsync().

private void setUpMapIfNeeded() { 
    // Do a null check to confirm that we have not already instantiated the map. 
    if (mMap == null) { 
     // Try to obtain the map from the SupportMapFragment. 
     mMap =((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map)); 
     mapFragment.getMapAsync(this); 
     // Check if we were successful in obtaining the map. 
     if (mMap != null) { 
      setUpMap(); 
     } 
    } 
} 
+0

спасибо за помощь, но его высказывание theat (This) является ошибкой в ​​кодировании. –

Смежные вопросы