如何在 Android 应用程序中使用 Geocoder 在特定位置查找大陆 [英] how to find continent in particular location using Geocoder in android app

查看:16
本文介绍了如何在 Android 应用程序中使用 Geocoder 在特定位置查找大陆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

   i am developing android application using Geocoder services,
   I have an application where I try to get address of a location based on 
   the  latitude,longitude coordinates its working fine.  
   my problem is how to get continent of particular address.

example : double lat=17; double lon=78.49;

List addresses = new Geocoder(Shout.this,Locale.getDefault()).getFromLocation(lat, lon, 1);

i am using this code output is India,Hyderabad this address related how to find continent ,please help me some valuable solution.

i am getting country name dynamically using geocoder is their any chance to get in continent name along with country.it is difficult to maintain statically i need dynamically any free services find continent based services

Thanks In Advance

解决方案

I don't think there is such information given by Google's API. The only solution I can think of is to have some kind of static data structure mapping country names to continent names (which you would presumably have to find yourself somehow, for instance by scraping this web page... ). Then you could text search the string that GeoCoder gives you and return the continent corresponding to the closest matching country name (which would be the key in your String mapping). (You would also have to treat the special case of US addresses which, annoyingly, end just with the state code)

这篇关于如何在 Android 应用程序中使用 Geocoder 在特定位置查找大陆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆