你好,我一直在使用本指南確定locationof用戶:http://developer.android.com/guide/topics/location/obtaining-user-location.html獲取與GPS /網絡的Android MapView的用戶當前位置
和我當前的代碼看起來是這樣的:
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
test = new GeoPoint((int)location.getLatitude()*1000000, (int)location.getAltitude()*1000000);
mapController.animateTo(test);
}
@Override
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}
@Override
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
}
};
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
}
只有
我當我使用此活動時,會收到錯誤並關閉應用程序。
感謝幫助
你可以發佈你的logcat痕跡嗎? – Reno 2011-02-16 10:27:20
請發佈錯誤日誌 – Mathew 2011-02-16 11:04:36