我变得疯狂,因为我必须从 gps 获得我的位置,通过mMyLocationOverlay.getMyLocation()
从 a ListActivity
AND NOT获得MapActivity
。GetMyLocation
想要我没有的上下文和地图视图。我试图采取 a但我在构造函数mapActivity
上运行时出错。我发布了错误的代码:" Caused by: java.lang.IllegalArgumentException: mapView == null "
MyLocationOverlay()
public class ListDeals extends ListActivity
{
private Events[] events;
private MyLocationOverlay mMyLocationOverlay;//Riferimento al MyLocationOverlay
private GeoPoint myPoint = null;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
String type = this.getIntent().getStringExtra("type"); //legge cosa c'era scritto nell'intent per avere il dato necessario per fare la query al db
setContentView(R.layout.list_view_x_deals);
MapView mMapView = (MapView) findViewById(R.id.mapview);
mMyLocationOverlay = new MyLocationOverlay(this, MyMapView.mapView);
myPoint = mMyLocationOverlay.getMyLocation();
MyMapView.mapView 是在我的 MapActivity 中创建的“最终 MapView”。
我哪里错了?