好吧,我已经为此搜索了相当长的时间。
我有一个距我新发现的位置的纬度/经度。 geocoder 的 getFromLocation 从纬度/经度返回一定数量的地址,这一切都很好。然后我将它放入一个适配器中,该适配器填充了一个旋转器......也运行得很好。
但我现在需要的是获取公司名称而不是地址。我更喜欢使用经纬度来获取一定距离内的所有企业,因为并非所有从 getFromLocation 返回的地址都是完整的。有些只是邻里或国家。
尽管我还没有实现,但这个链接做得很好。在我看来,对于像谷歌这样的巨头来说,这似乎是相当标准的处理能力。
http://www.smnirven.com/?p=39 http://www.smnirven.com/?p=39
提前致谢。
public void getFeature() {
double lat = currentLocation.getLatitude();
double lon = currentLocation.getLongitude();
Geocoder gc = new Geocoder(getBaseContext(), Locale.getDefault());
try {
List<Address> tmpfeatures = gc.getFromLocation(lat, lon, 15);
Iterator itr = tmpfeatures.iterator();
while (itr.hasNext()) {
featuresAdapter.add(((Address) itr.next()).getFeatureName().toString());
}
} catch (IOException e) {
e.printStackTrace();
}
}
谷歌地方信息API。注册开发者预览版。
https://developers.google.com/places/documentation https://developers.google.com/places/documentation
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)