私はGoogle Map API v2
自分のアプリケーションでマップを表示するために使用しています。
アプリケーションでGoogleマップを有効にするためのすべての手順を実行しました。
public class PinLocationOnMapView extends FragmentActivity {
private double mLatitude = 0.0, mLongitude = 0.0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SupportMapFragment fragment = SupportMapFragment.newInstance();
getSupportFragmentManager().beginTransaction()
.add(android.R.id.content, fragment).commit();
}
}
このコードを使用するとマップが表示されますが、緯度/経度の値を指定すると、マップタイルが読み込まれず、白いタイルしか表示されません。
上記のクラスのonCreate()で記述されたコードは次のとおりです。
if (getIntent().getExtras() != null) {
final Bundle bundle = getIntent().getBundleExtra("LOCATION");
mLatitude = bundle.getDouble("LATITUDE");
mLongitude = bundle.getDouble("LONGITUDE");
} else {
finish();
}
GoogleMapOptions options = new GoogleMapOptions();
LatLng latLng = new LatLng(mLatitude, mLongitude);
CameraPosition cameraPosition;// = new CameraPosition(latLng, 0, 0, 0);
cameraPosition = CameraPosition.fromLatLngZoom(latLng, (float) 14.0);
options.mapType(GoogleMap.MAP_TYPE_SATELLITE).camera(cameraPosition)
.zoomControlsEnabled(true).zoomGesturesEnabled(true);
SupportMapFragment fragment = SupportMapFragment.newInstance(options);
getSupportFragmentManager().beginTransaction()
.add(android.R.id.content, fragment).commit();
また、緯度/経度の値のリストがあります。それらをに表示したいのですが、複数のマーカーを表示するにはどうすればよいMapFragment
ですか?MapFragment
MapView
とを試してみましItemizedOverlay
たが、うまくいきませんでした。SHA1
キーを取得するためのキーを正しく作成したと思いますAPI
。これが間違っていると、マップも使用できなかったためですMapFragment
が、lat/log値を渡さないと確認できます。