use of com.amap.api.services.core.SuggestionCity in project ride-read-android by Ride-Read.
the class MapFragment method onPoiSearched.
@Override
public void onPoiSearched(PoiResult poiResult, int i) {
if (null == poiResult)
return;
List<PoiItem> poiList = poiResult.getPois();
if (!ListUtils.isEmpty(poiList)) {
PoiItem firstResult = poiList.get(0);
LatLonPoint resultPoint = firstResult.getLatLonPoint();
LatLng resultLatLng = new LatLng(resultPoint.getLatitude(), resultPoint.getLongitude());
mAMap.moveCamera(CameraUpdateFactory.changeLatLng(resultLatLng));
ToastUtils.show("搜索结果为:" + firstResult.getAdName());
} else {
List<SuggestionCity> suggestionCitys = poiResult.getSearchSuggestionCitys();
if (!ListUtils.isEmpty(suggestionCitys)) {
ToastUtils.show("搜索失败,建议搜索填写:" + suggestionCitys.get(0).getCityName());
}
}
}
Aggregations