安卓:请问地址(从地理$ C $三)有固定的格式? [英] Android: Does Address(from GeoCode) have fixed format?

查看:109
本文介绍了安卓:请问地址(从地理$ C $三)有固定的格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要确定的地址,地缘位置,所以我用地理codeR和地址,我想打印一个地址对象,并得到如下:

I need to determine the address for a geo location, so I used GeoCoder and Address, I tried to print an Address object and got the following:

(出于隐私原因,我用了一些假的数据,但我收到了我的设备上的数据是真实的)

(for privacy reason, I used some fake data, but the data I received on my device is real)

地址[addressLines = [0:123 ABC ST,1:墨尔本维多利亚1234,2:澳大利亚],功能= 123,管理=维多利亚,子管理员= NULL,局部性=墨尔本,通途= ABC St,postal$c$c=1234,country$c$c=AU,countryName=Australia,hasLatitude=true,latitude=-123.321,hasLongitude=true,longitude=123.321,phone=null,url=null,extras=null]

Address[addressLines=[0:"123 ABC St",1:"Melbourne VIC 1234",2:"Australia"],feature=123,admin=Victoria,sub-admin=null,locality=Melbourne,thoroughfare=ABC St,postalCode=1234,countryCode=AU,countryName=Australia,hasLatitude=true,latitude=-123.321,hasLongitude=true,longitude=123.321,phone=null,url=null,extras=null]

现在我想知道,我可以假设:

Now I'm wondering, can I assume that:

  1. 在地址线指标0总是街道地址?
  2. 和索引1并为郊区,州,交code对,索引2是该国?
  3. 在功能其实是街道号码(如123)?
  4. 在管理是一个国家?

如果格式不固定,如何获得地址信息? 谢谢!

If the format is NOT fixed, how do I get address information? Thanks!

推荐答案

我不认为格式是固定的,你不应该依赖于数组索引。从文档:

I don't think that the format is fixed and you should not rely on the array indexes. From the docs:

细节的逆量   地理codeD的位置描述可能   而有所不同,例如,一个可能包含   最接近完整的街道地址。   建筑,而另一个可能包含   只有一个城市的名称和邮政code。该   地理codeR类需要一个后台   未包括在服务   核Android框架。

The amount of detail in a reverse geocoded location description may vary, for example one might contain the full street address of the closest building, while another might contain only a city name and postal code. The Geocoder class requires a backend service that is not included in the core android framework.

地理编码服务是由运行在backgroind我相信谷歌地图服务实现。您应该使用地址类来获取你所需要的地址的元素

The geocoding service is implemented by the Google Maps service which runs in the backgroind I believe. You should use Address class to fetch the elements of the address that you require.

这篇关于安卓:请问地址(从地理$ C $三)有固定的格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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