获取用户位置错误
我是android开发的初学者,我正在尝试通过gps获取用户位置。我在以下代码中给出错误:
// Define a listener that responds to location updates
LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
// Called when a new location is found by the network location provider.
// makeUseOfNewLocation(location);
LocationProvider locationProvider = LocationManager.GPS_PROVIDER;
}
在这一行中,
LocationProvider locationProvider = LocationManager.GPS_PROVIDER;
我收到如下错误:“类型不匹配:无法从 String 转换为 LocationProvider”
该行有什么问题
I am beginner in android development and i am triying to get user location by gps. i give a error in the following code:
// Define a listener that responds to location updates
LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
// Called when a new location is found by the network location provider.
// makeUseOfNewLocation(location);
LocationProvider locationProvider = LocationManager.GPS_PROVIDER;
}
in this line
LocationProvider locationProvider = LocationManager.GPS_PROVIDER;
i get an error like this : "Type mismatch: cannot convert from String to LocationProvider"
what is the problem in that line
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道足够的知识来调试其他人的代码,但这个代码
是
我在我的一个应用程序中使用的来获取位置信息
的
西蒙
I don't know enough to debug anyone else's code but this code
}
is what I use in one of my apps to get location info
regards
Simon