奇怪的谷歌API位置更新(使用GPS)问题
我编写了一个应用程序,使用 LocationManager 在谷歌地图 API 上绘制我的位置...
它在我的设备上运行得很好。我关闭了我的设备(关闭)并关闭了我的 Eclipse IDE ...
稍后我再次启动我的应用程序后,应用程序显示“应用程序意外停止”,我不得不强行关闭...
我不知道是什么问题是……!!
我尝试从 IDE 运行它并遇到同样的问题...
但是我在崩溃之前与一些朋友共享了代码,他们使用相同的 Google 地图 API 密钥运行它/
有谁知道导致错误的原因...(错误是致命异常:主要)
代码的一部分可能很重要......
尝试{
int longTemp = (int)(lastKnownLoc.getLongitude()* 1000000);
int latTemp = (int)(lastKnownLoc.getLatitude() * 1000000);
gp = new GeoPoint(latTemp, longTemp);
} 捕获(异常 e) {
}
我需要尽快帮助。
I wrote an app that plots my position on the google map API using LocationManager ...
It was working perfectly on my device. I turned off my device (switched off) and closed my Eclipse IDE ...
After I started my app again later, the app says " THe app stopped unexpectedly" and I had to force close ...
I don't know what the problem is ...!!
I tried running it from the IDE and the same problem ...
BUT I shared the code with some friends before it crashed and they were running it using the same Google map API key /
Does anyone know what's causing the error ... (Error is Fatal Exception : Main)
A part of code that may be of importance...
try{
int longTemp = (int)(lastKnownLoc.getLongitude()* 1000000);
int latTemp = (int)(lastKnownLoc.getLatitude() * 1000000);
gp = new GeoPoint(latTemp, longTemp);
}
catch (Exception e)
{}
I need help asap .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的lastKnownLoc 可能为空。
使用前需要检查是否有 LastKnownLocation
Your lastKnownLoc may be null.
You need to check if there is a LastKnownLocation before use it