如何设置超时Geocoder android?

时间:2016-01-12 04:06:22

标签: android timeout google-geocoder

我使用Geocoder从名称中搜索位置,这是我的代码:

Geocoder geocoder = new Geocoder(this, Locale.getDefault());
List<Address> addresses = geocoder.getFromLocationName(text, 10);
下面的

text来自searchView

它工作正常,但是当wifi无法连接(丢失的互联网)时,此searchView将挂起,直到它从服务器获得响应:Timed out waiting for response from server。 这使我的UI看起来像挂起和崩溃随时。我可以更改Geocoder的超时,大约3秒或更短吗?

任何帮助。感谢。

0 个答案:

没有答案