我需要根据经纬度在地图中显示特定位置,并在该特定位置显示标记。但是,我已经显示了整个地图,但没有得到具体的位置。
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));
} }