本文介绍了从谷歌Android将API获取城市名称和邮政code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用
一切工作正常,但是当我得到的结果如图所示这里我没有城市和邮政code信息
Everything work fine but when I get the result as shown here I don't have the city and postal code informations
private ResultCallback<PlaceBuffer> mUpdatePlaceDetailsCallback
= new ResultCallback<PlaceBuffer>() {
@Override
public void onResult(PlaceBuffer places) {
if (!places.getStatus().isSuccess()) {
// Request did not complete successfully
Log.e(TAG, "Place query did not complete. Error: " + places.getStatus().toString());
return;
}
// Get the Place object from the buffer.
final Place place = places.get(0);
// Format details of the place for display and show it in a TextView.
mPlaceDetailsText.setText(formatPlaceDetails(getResources(), place.getName(),
place.getId(), place.getAddress(), place.getPhoneNumber(),
place.getWebsiteUri()));
Log.i(TAG, "Place details received: " + place.getName());
}
};
借助没有按类T放入系统包含的信息,我可以得到完整的人类可读地址,lat和长等优点
The Place class doesn't contain thoses information, I can get the full human readable address, the lat and long etc
我怎样才能从自动完成结果的城市和邮政code?
How can I get the city and postal code from the autocomplete result ?
推荐答案
不幸的是该信息可通过此时的Android API不可用。
Unfortunately this information isn't available via the Android API at this time.
它可以使用Places API Web服务()。
It is available using the Places API Web Service (https://developers.google.com/places/webservice/).
这篇关于从谷歌Android将API获取城市名称和邮政code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!