获取与GPS /网络的Android的MapView用户当前位置 [英] Get user current position with gps/network android MapView
本文介绍了获取与GPS /网络的Android的MapView用户当前位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我一直在使用本指南确定locationof用户:的http://developer.android.com/guide/topics/location/obtaining-user-location.html
Hello I've been using this guide to determine the locationof the user: http://developer.android.com/guide/topics/location/obtaining-user-location.html
和我目前的code是这样的:
and my current code looks like this:
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);
}
我只得到错误和应用程序,虽然关闭,当我使用这个活动。
I only get error and the app shuts down though when I'm using this activity.
为感谢帮助
/奔
推荐答案
我解决了这个问题,我没有实例mapContoller:>。不过,我现在已经另一个问题。我将在另外的问题。
I solved it, I didn't instantiate mapContoller :>. But I've another problem now. which I will post in another question.
这篇关于获取与GPS /网络的Android的MapView用户当前位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文