我在地下室使用我的模拟器。此代码正在运行。但地图未显示当前位置。我还尝试从模拟器控件发送 lat long,但模拟器控件显示错误的 lat lon。
package com.maps;
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 android.content.Context;
import android.location.Location;
import android.location.LocationListener;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MapView view= (MapView) findViewById(R.id.mapView) ;
view.setBuiltInZoomControls(true);
final MapController control=view.getController();
LocationManager manager=(LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
LocationListener listener=new LocationListener() {
public void onStatusChanged(String provider, int status, Bundle extras) {
}
public void onProviderEnabled(String provider) {
}
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}
};
manager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, listener);
}
@Override
protected boolean isRouteDisplayed()
{
return true;
}
}