I am becoming crazy because i must get my position from gps, throught mMyLocationOverlay.getMyLocation()
FROM a ListActivity
AND NOT MapActivity
. GetMyLocation
wants context and mapview that i don't have. I tried to take a mapActivity
but i get Error to runtime " Caused by: java.lang.IllegalArgumentException: mapView == null "
on MyLocationOverlay()
constructor . I post my wrong code:
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();
Where MyMapView.mapView is a "final MapView" created inside the my MapActivity.
Where do i wrong?