我正在使用FusedLocation提供商,即使我的手机中的Internet Services已关闭,我也不希望我的应用程序崩溃。我尝试使用尝试/捕获,没有用
注意:互联网服务故意在我的手机中关闭。
在下行中出现错误:
addresses = geocoder.getFromLocation(latitude, longitude, 1)
即使Internet服务已关闭,我也不希望我的应用程序崩溃,并希望将问题捕获到Catch Block中。 我已经实现了try/catch块,但是我的应用程序仍然通过给出以下例外而
:
崩溃 提前致谢。
NOTE: Internet services are OFF intentionally in my phone.
Getting error at the below line:
addresses = geocoder.getFromLocation(latitude, longitude, 1)
I don't want my application to crash even if the internet service is off and want the issue to be caught in catch block.
I have implemented the try/catch block, but still my app crashed by giving the below exception:
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
is there any solution for my problem.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该在单独的线程
检索地址上调用地理编码器:
You should call Geocoder on a separate thread
Retrieve address: