我有一张地图,我想在上面放一个标记,但标记没有显示出来。这是我的代码:
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
import com.google.android.maps.OverlayItem;
public class MapDetailActivity extends MapActivity
{
private final static String TAG = MapDetailActivity.class.getSimpleName();
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
this.setContentView(R.layout.map_view);
// get longitude and latitude values from detail activity/object
Bundle bundle = this.getIntent().getExtras();
float latitude = bundle.getFloat("uie.top25.seattle.latitude");
float longitude = bundle.getFloat("uie.top25.seattle.longitude");
Log.i(TAG, "Latitude that is set : " + latitude);
Log.i(TAG, "Longitude that is set : " + longitude);
// create longitude and latitude map points
Double lat = latitude * 1E6;
Double lon = longitude * 1E6;
// create point on map
GeoPoint point = new GeoPoint(lat.intValue(), lon.intValue());
OverlayItem oi = new OverlayItem(point, null, null);
MapView mapView = (MapView) this.findViewById(R.id.myMapView);
MapController mapController = mapView.getController();
// set point on map
mapController.animateTo(point);
oi.setMarker(oi.getMarker(R.drawable.mm_20_red));
// set zoom level
mapController.setZoom(19);
}
@Override
protected boolean isRouteDisplayed()
{
// No driving directions, so this method returns false
return false;
}
}
有人可以告诉我我做错了什么吗?