代码:
public class MainBoard extends FragmentActivity implements OnClickListener, OnTouchListener, LocationListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
//Location Listener
current_location = new MarkerOptions();
current_location.icon(BitmapDescriptorFactory.fromResource(R.drawable.location));
LocationManager locationManager = (LocationManager)getSystemService(getApplicationContext().LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1, 1, this);
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1, 1, this);
}
//LocationListener
@Override
public void onLocationChanged(Location location) {
Log.d("LocationListener", "LocationChanged");
updateCurrentLocation(location);
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {}
@Override
public void onProviderEnabled(String provider) {
Log.d("LocationListener", "onProviderEnabled");
instantiatePosition();
}
@Override
public void onProviderDisabled(String provider) {
Log.d("LocationListener", "onProviderDisabled");
showGPSOfflineAlert();
}
}
我真的看不到这里的错误,LogCat没有报告任何错误,但没有调用任何方法,甚至没有onProviderEnabled或onProviderDisabled ...
提前致谢:)