0

海蘭大家....... 我已經成功地得到了Google maps android API v2工作 但谷歌地圖使用FragmentActivity用於顯示地圖 我想用片段中顯示地圖 目前即時使用此代碼但谷歌Android API V2映射在片段

@SuppressLint("NewApi") 
@Override 
protected void onCreate(Bundle savedInstanceState) 
{ 
    super.onCreate(savedInstanceState); 
    try 
    { 
     setContentView(R.layout.maps); 
     map = ((SupportMapFragment)   getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); 
     Marker hamburg = map.addMarker(new MarkerOptions() 
       .position(HAMBURG).title("Hamburg")); 
     Marker kiel = map.addMarker(new MarkerOptions() 
       .position(KIEL) 
       .title("Kiel") 
       .snippet("Kiel is cool") 
       .icon(BitmapDescriptorFactory 
         .fromResource(R.drawable.ic_launcher))); 

     // Move the camera instantly to hamburg with a zoom of 15. 
     map.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 15)); 

     // Zoom in, animating the camera. 
     map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null); 
    } 
    catch (Exception e) 
    { 
     // TODO Auto-generated catch block 
     Log.d("Error in Maps.class = " , e.toString()); 
    } 
} 

代替從FragmentActivity我想從片段即延伸顯示地圖的片段 內部在這方面的任何幫助延伸將高度讚賞..預先 感謝.. .....

回答