Geocoder's isPresent() method always returns false

前端 未结 3 1675
醉话见心
醉话见心 2020-12-06 21:36

I had written a simple Activity to test presence of Geocoder, calling Geocoder.isPresent() always returns false.

Class:

public class LocationTestActi         


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-06 22:19

    Use AsyncTask to fetch coordinates from server using geocoder. For example, getFromLocationName() should be called using AsyncTask. UI thread (main activity) does not allow the tasks which take too much time, hence the method returns empty list.

提交回复
热议问题