我已经完成了所有Google Play服务,并已全部导入
public class Check extends Activity {
static final LatLng HAMBURG = new LatLng(53.558, 9.927);
static final LatLng KIEL = new LatLng(53.551, 9.993);
private GoogleMap map;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
map = ((MapFragment) getFragmentManager().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 with animation:
map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
setContentView(R.layout.map);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
答案 0 :(得分:0)
您是否拥有Google Maps API密钥? 您应该注册并获取密钥并按顺序将其放入您的应用程序中 能够使用他们的Api。 看到这个链接: https://developers.google.com/maps/documentation/android/start#get_an_android_certificate_and_the_google_maps_api_key