Android Google Map v2 Marker未显示

时间:2013-12-04 10:36:41

标签: android google-maps

我正在尝试使用Google地图v2中的特定坐标绘制标记,但它不会在给定位置显示标记。

我确实去谷歌,但没有找到任何有用的帮助,请...

    if (googleMap == null) {
            googleMap = ((MapFragment) getFragmentManager().findFragmentById(
                    R.id.map)).getMap();

            // check if map is created successfully or not
            if (googleMap == null) {
                Toast.makeText(getApplicationContext(),
                        "Sorry! unable to create maps", Toast.LENGTH_SHORT)
                        .show();
     double latitude = 13.094192 ;
     double longitude = 80.121689;
     MarkerOptions marker = new MarkerOptions().position(new LatLng(latitude, longitude)).title("Hello Maps ");

// adding marker

    googleMap.addMarker(marker);

1 个答案:

答案 0 :(得分:2)

改变:

if (googleMap !=null){
  Marker hamburg = map.addMarker(new MarkerOptions().position(new LatLng(latitude, longitude))
      .title("Hello Maps"));

}
相关问题