Java Code Examples for com.baidu.mapapi.search.poi.PoiResult#getSuggestCityList()

The following examples show how to use com.baidu.mapapi.search.poi.PoiResult#getSuggestCityList() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AddressEditDelegate.java    From FastWaiMai with MIT License 5 votes vote down vote up
/**
 * 获取POI搜索结果,包括searchInCity,searchNearby,searchInBound返回的搜索结果
 *
 * @param poiResult Poi检索结果,包括城市检索,周边检索,区域检索
 */
@Override
public void onGetPoiResult(PoiResult poiResult) {
	if (poiInfoListForSearch != null) {
		poiInfoListForSearch.clear();
	}
	if (poiResult == null || poiResult.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) {
		Toast.makeText(getContext(), "未找到结果", Toast.LENGTH_LONG).show();
		initPoiSearchListView();
		return;
	}

	if (poiResult.error == SearchResult.ERRORNO.NO_ERROR) {
		poiInfoListForSearch = poiResult.getAllPoi();
		showSeachView();
		initPoiSearchListView();
		return;
	}

	if (poiResult.error == SearchResult.ERRORNO.AMBIGUOUS_KEYWORD) {
		// 当输入关键字在本市没有找到,但在其他城市找到时,返回包含该关键字信息的城市列表
		String strInfo = "在";

		for (CityInfo cityInfo : poiResult.getSuggestCityList()) {
			strInfo += cityInfo.city;
			strInfo += ",";
		}

		strInfo += "找到结果";
		Toast.makeText(getContext(), strInfo, Toast.LENGTH_LONG).show();
	}
}
 
Example 2
Source File: LocationDelegate.java    From FastWaiMai with MIT License 5 votes vote down vote up
@Override
public void onGetPoiResult(PoiResult poiResult) {
	if (poiInfoListForSearch != null) {
		poiInfoListForSearch.clear();
	}
	if (poiResult == null || poiResult.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) {
		Toast.makeText(getContext(), "未找到结果", Toast.LENGTH_LONG).show();
		//initPoiSearchListView();
		return;
	}

	if (poiResult.error == SearchResult.ERRORNO.NO_ERROR) {
		poiInfoListForSearch = poiResult.getAllPoi();
		//showSeachView();
		initPoiSearchListView();
		return;
	}

	if (poiResult.error == SearchResult.ERRORNO.AMBIGUOUS_KEYWORD) {
		// 当输入关键字在本市没有找到,但在其他城市找到时,返回包含该关键字信息的城市列表
		String strInfo = "在";

		for (CityInfo cityInfo : poiResult.getSuggestCityList()) {
			strInfo += cityInfo.city;
			strInfo += ",";
		}

		strInfo += "找到结果";
		Toast.makeText(getContext(), strInfo, Toast.LENGTH_LONG).show();
	}
}
 
Example 3
Source File: MainActivity.java    From BaiDuMapSelectDemo with Apache License 2.0 5 votes vote down vote up
/**
 * 获取POI搜索结果,包括searchInCity,searchNearby,searchInBound返回的搜索结果
 *
 * @param poiResult Poi检索结果,包括城市检索,周边检索,区域检索
 */
@Override
public void onGetPoiResult(PoiResult poiResult) {
    if (poiInfoListForSearch != null) {
        poiInfoListForSearch.clear();
    }
    if (poiResult == null || poiResult.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) {
        Toast.makeText(mContext, "未找到结果", Toast.LENGTH_LONG).show();
        initPoiSearchListView();
        return;
    }

    if (poiResult.error == SearchResult.ERRORNO.NO_ERROR) {
        poiInfoListForSearch = poiResult.getAllPoi();
        showSeachView();
        initPoiSearchListView();
        return;
    }

    if (poiResult.error == SearchResult.ERRORNO.AMBIGUOUS_KEYWORD) {
        // 当输入关键字在本市没有找到,但在其他城市找到时,返回包含该关键字信息的城市列表
        String strInfo = "在";

        for (CityInfo cityInfo : poiResult.getSuggestCityList()) {
            strInfo += cityInfo.city;
            strInfo += ",";
        }

        strInfo += "找到结果";
        Toast.makeText(mContext, strInfo, Toast.LENGTH_LONG).show();
    }
}