我需要根据纬度,长度以及该特定位置的显示标记在地图中显示特定位置。 但是,我已经显示了整个地图但没有获得具体位置。
public class MapActivity extends FragmentActivity {
GoogleMap googleMap;
MarkerOptions markerOptions;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
Intent intent = getIntent();
String title = intent.getStringExtra("title");
String lat = intent.getStringExtra("lat");
String lon = intent.getStringExtra("long");
double Lon = Double.parseDouble(lon);
double Lat = Double.parseDouble(lat);
SupportMapFragment supportMapFragment = (SupportMapFragment)
getSupportFragmentManager().findFragmentById(R.id.map);
googleMap = supportMapFragment.getMap();
googleMap.addMarker(new MarkerOptions()
.position(new LatLng(Lat, Lon))
.title(title));
} }
答案 0 :(得分:1)
试试如下:
private Marker myMarker; myMarker=googleMap.addMarker(new MarkerOptions() .position(new LatLng(Lat, Lon)) .title(title) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));