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)はコーディングのエラーです。 –

関連する問題