(未显示1个用户的6个中间版本) | |||
第1行: | 第1行: | ||
− | <div id="examples_center"> | + | <div id="examples_center"><!-- 页面标题 --><div class="title-hd">地点检索</div><!-- 标题下子标题及简介,可有多个 --><div class="title-mi">功能场景</div><div class="wrap-mi">支持用户根据关键词查询出行的起终点、兴趣点等,可结合路线规划、导航等功能使用。</div><!-- --></div><div class="demos_wrap"><div class="header"><div class="andiord-header active">Android</div><div class="ios-header">iOS</div></div><div class="andiord-wrap wrap"><div class="wrap-wp"><div class="wrap_left"><div class="left-video"><div class="img-bg-and"></div><div class="phone-android"><div class="video-wrap infor"><div class="video-control"></div><!-- 安卓视频位置 (不写协议)--><pre>https://mapopen-website-wiki.bj.bcebos.com/demos/AndroidVideos/didianjiansuo_2.mp4</pre> |
− | + | </div><div class="video-icon-and"><div class="play play-and"></div><div class="stop stop-and"></div></div></div><div class="progressWrap-hide-and"></div><div id="videoControls-and"><div id="progressWrap-and"><div id="playProgress-and"></div></div></div></div><div class="left-qrCode"><!-- 安卓二维码位置 --><div class="qrCode-and">1590746640|//mapopen-website-wiki.bj.bcebos.com/demos/newqrcodes/地点检索@2xanidroid.png</div><div>扫码体验</div></div></div><div class="wrap_right"><div class="wrap_right_nav"><div class="wrap_right_nav_l"><div>使用产品</div><div><!-- IOS使用产品下选项,可有多个 --><div class="documentA">Android地图SDK|/index.php?title=androidsdk</div><!-- --><div>></div><div class="documentA">POI城市检索|/index.php?title=androidsdk/guide/search/poi</div></div><div><!-- IOS使用产品下选项,可有多个 --><div class="documentA">Android地图SDK|/index.php?title=androidsdk</div><!-- --><div>></div><div class="documentA">地点输入提示检索|/index.php?title=androidsdk/guide/search/poi</div></div></div><div class="wrap_right_nav_r">下载源码</div><!-- 安卓源码地址 --><div class="github-url-and">//mapopen-website-wiki.bj.bcebos.com/demos/BaiduMapSDKExample.zip</div></div><div class="wrap_table"><div class="table_nav"><div class="left-icon"></div><div>核心接口</div></div><div class="table_wrap"><div class="table_wrap_title"><div>类</div><div>接口</div><div>描述</div></div><!-- 表格接口,可有多个 --><div class="table_wrap_con"><div class="table_wrap_w"><div><div class="table-wrap-className">PoiSearch</div></div><div><div>searchInCity(PoiCitySearchOption option)</div></div><div><div>城市内检索</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">PoiSearch</div></div><div><div>setOnGetPoiSearchResultListener(OnGetPoiSearchResultListener poiResultListener)</div></div><div><div>设置检索结果回调</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">PoiCitySearchOption</div></div><div><div>city(String city)</div></div><div><div>设置检索城市</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">PoiCitySearchOption</div></div><div><div>keyword(String key)</div></div><div><div>搜索关键字</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">PoiCitySearchOption</div></div><div><div>cityLimit(boolean cityLimit)</div></div><div><div>设置区域数据召回限制 为true时,仅召回city对应区域内数据</div></div></div></div></div></div></div></div><div class="pre-nav"><div class="left-icon"></div><div>重点关注</div></div><div class="pre-nav"><div style="margin-left: 10px;">检索完成后需要调用PoiSearch的destroy()方法,否则会有内存泄露。</div></div><div class="pre-nav"><div class="left-icon"></div><div>核心代码</div></div><div class="pre-nav"><div>1.发起检索请求</div></div><div class="pre-wrap"><div class="pre-wrap-nav"><div>JAVA</div></div><!-- 安卓示例代码位置 --><div class="pre-wrap-w pre-wrap-w-and"><pre class="prettyprint prettyprinted pre-and">// 发起请求 | |
− | + | ||
− | + | ||
− | + | ||
− | </div> | + | |
− | <div class="demos_wrap"> | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
mPoiSearch.searchInCity((new PoiCitySearchOption()) | mPoiSearch.searchInCity((new PoiCitySearchOption()) | ||
.city(cityStr) | .city(cityStr) | ||
第209行: | 第8行: | ||
.scope(scope)); | .scope(scope)); | ||
</pre> | </pre> | ||
− | + | <div class="pre-btn"><div class="pre-btn-copy-and">复制</div><div class="pre-btn-cb-and">深色</div></div><div class="success">复制成功</div></div></div><div class="pre-nav"><div>2.检索结果回调处理</div></div><div class="pre-wrap"><div class="pre-wrap-nav"><div>JAVA</div></div><!-- 安卓示例代码位置 --><div class="pre-wrap-w pre-wrap-w-and"><pre class="prettyprint prettyprinted pre-and">@Override | |
− | + | public void onGetPoiResult(PoiResult poiResult) { | |
− | + | if (poiResult == null || poiResult.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) { | |
− | + | Toast.makeText(PoiCitySearchActivity.this, "未找到结果", Toast.LENGTH_LONG).show(); | |
− | + | return; | |
− | + | } | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | // | + | List<PoiInfo> poiInfos = poiResult.getAllPoi(); |
− | + | if (null == poiInfos) { | |
− | + | return; | |
+ | } | ||
+ | |||
+ | // 隐藏之前的 | ||
+ | hidePoiInfoLayout(); | ||
+ | |||
+ | mRecyclerView.setVisibility(View.VISIBLE); | ||
+ | |||
+ | if (null == mPoiItemAdaper) { | ||
+ | mPoiItemAdaper = new PoiItemAdapter(poiInfos); | ||
+ | } else { | ||
+ | mPoiItemAdaper.updateData(poiInfos); | ||
+ | } | ||
} | } | ||
− | // | + | </pre> |
− | - (void) | + | <div class="pre-btn"><div class="pre-btn-copy-and">复制</div><div class="pre-btn-cb-and">深色</div></div><div class="success">复制成功</div></div></div></div><div class="ios-wrap wrap" style="display: none;"><div class="wrap-wp"><div class="wrap_left"><div class="left-video"><div class="img-bg-ios-sh"></div><div class="phone-ios"><div class="video-wrap infor"><div class="video-control"></div><!-- ios视频位置 --><pre>https://mapopen-website-wiki.bj.bcebos.com/demos/iosVideos/地点检索@3xios.mp4</pre> |
− | [self | + | </div><div class="video-icon-ios"><div class="play play-ios"></div><div class="stop stop-ios"></div></div></div><div class="progressWrap-hide-ios"></div><div id="videoControls-ios"><div id="progressWrap-ios"><div id="playProgress-ios"></div></div></div></div><div class="left-qrCode iosqrCode"><!-- ios二维码位置 --><div class="qrCode-ios">1590746640|//mapopen-website-wiki.bj.bcebos.com/demos/ioscodes/地点检索@1xios.png</div><div>扫码体验</div></div></div><div class="wrap_right"><div class="wrap_right_nav"><div class="wrap_right_nav_l"><div>使用产品</div><div><!-- IOS使用产品下选项,可有多个 --><div class="documentA">iOS地图SDK|/index.php?title=iossdk</div><!-- --><div>></div><div class="documentA">POI城市检索|/index.php?title=iossdk/guide/search/poi</div></div><div><!-- IOS使用产品下选项,可有多个 --><div class="documentA">iOS地图SDK|/index.php?title=iossdk</div><!-- --><div>></div><div class="documentA">地点输入提示检索|/index.php?title=iossdk/guide/search/suggestion</div></div></div><div class="wrap_right_nav_r">下载源码</div><!-- IOS源码地址 --><div class="github-url-ios">//mapopen-website-wiki.bj.bcebos.com/BaiduMapSDKDemo.zip</div></div><div class="wrap_table"><div class="table_nav"><div class="left-icon"></div><div>核心接口</div></div><div class="table_wrap"><div class="table_wrap_title"><div>类</div><div>接口</div><div>描述</div></div><!-- ios表格接口内容,可有多个 --><!-- 表格接口,可有多个 --><div class="table_wrap_con"><div class="table_wrap_w"><div><div class="table-wrap-className">BMKPOICitySearchOption</div></div><div><div>NSString *keyword</div></div><div><div>检索关键字(必选)</div></div></div><!-- --><div class="table_wrap_w"><div><div class="table-wrap-className">BMKPOICitySearchOption</div></div><div><div>NSString *city</div></div><div><div>区域名称(必选)</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">BMKPOICitySearchOption</div></div><div><div>Bool isCityLimit</div></div><div><div>区域数据返回限制(可选)</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">BMKPoiSearch</div></div><div><div>- (BOOL)poiSearchInCity:(BMKPOICitySearchOption*)option;</div></div><div><div>发起城市POI检索</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">BMKPoiSearch</div></div><div><div>- (void)onGetPoiResult:(BMKPoiSearch*)searcher result:(BMKPOISearchResult*)poiResult errorCode:(BMKSearchErrorCode)errorCode;</div></div><div><div>返回POI搜索结果</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">BMKSuggestionSearchOption</div></div><div><div>NSString *keyword</div></div><div><div>搜索关键字,必选</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">BMKSuggestionSearchOption</div></div><div><div>NSString *cityname</div></div><div><div>城市名,参数也可以传入citycode,必选</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">BMKSuggestionSearchOption</div></div><div><div>BOOL cityLimit</div></div><div><div>是否只返回指定城市检索结果(默认:NO)(提示:海外区域暂不支持设置cityLimit)</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">BMKSuggestionSearch</div></div><div><div>- (BOOL)suggestionSearch:(BMKSuggestionSearchOption *)suggestionSearchOption;</div></div><div><div>发起Sug检索服务</div></div></div><div class="table_wrap_w"><div><div class="table-wrap-className">BMKSuggestionSearch</div></div><div><div>- (void)onGetSuggestionResult:(BMKSuggestionSearch *)searcher result:(BMKSuggestionSearchResult *)result errorCode:(BMKSearchErrorCode)error;</div></div><div><div>返回Sug检索结果</div></div></div></div></div></div></div></div><div class="pre-nav"><div class="left-icon"></div><div>核心代码</div></div><div class="pre-nav"><div>1.发起Sug检索与POI检索</div></div><div class="pre-wrap"><div class="pre-wrap-nav"><div>Objective-C</div></div><div class="pre-wrap-w pre-wrap-w-ios code_container"><!-- ios示例代码位置 --><pre class="prettyprint prettyprinted pre-ios">// 根据输入发送sug检索 |
+ | - (void)searchSugInfoWithKey:(NSString *)key { | ||
+ | if (key.length == 0) { | ||
+ | self.sugInfoList = [NSMutableArray array]; | ||
+ | __weak typeof(self) weakSelf = self; | ||
+ | dispatch_async(dispatch_get_main_queue(), ^{ | ||
+ | [weakSelf.tableView reloadData]; | ||
+ | }); | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | BMKSuggestionSearchOption *option = [BMKSuggestionSearchOption new]; | ||
+ | option.keyword = key; | ||
+ | option.cityname = @"北京"; | ||
+ | option.cityLimit = YES; | ||
+ | |||
+ | BMKSuggestionSearch *sugSearch = [BMKSuggestionSearch new]; | ||
+ | sugSearch.delegate = self; | ||
+ | [sugSearch suggestionSearch:option]; | ||
+ | |||
} | } | ||
− | / | + | /// 根据联想词或关键词进行POI检索 |
− | - (void) | + | - (void)searchPOIInfoWithKey:(NSString *)key { |
− | if (key | + | if (!key) { |
+ | return; | ||
+ | } | ||
BMKPOICitySearchOption *option = [BMKPOICitySearchOption new]; | BMKPOICitySearchOption *option = [BMKPOICitySearchOption new]; | ||
option.keyword = key; | option.keyword = key; | ||
− | option.city = @" | + | option.city = @"北京"; |
option.isCityLimit = YES; | option.isCityLimit = YES; | ||
− | + | ||
BMKPoiSearch *search = [BMKPoiSearch new]; | BMKPoiSearch *search = [BMKPoiSearch new]; | ||
search.delegate = self; | search.delegate = self; | ||
[search poiSearchInCity:option]; | [search poiSearchInCity:option]; | ||
− | |||
} | } | ||
+ | #pragma mark - UISearchBarDelegate | ||
− | #pragma mark - | + | // 输入回调 |
− | + | - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { | |
− | / | + | // sug检索 |
− | - (void) | + | [self searchSugInfoWithKey:searchText]; |
− | if ( | + | } |
− | self. | + | // 确认检索 |
+ | - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { | ||
+ | // POI检索 | ||
+ | [self searchPOIInfoWithKey:searchBar.text]; | ||
+ | } | ||
+ | |||
+ | </pre> | ||
+ | <div class="pre-btn"><div class="pre-btn-copy-ios">复制</div><div class="pre-btn-cb-ios">深色</div></div><div class="success">复制成功</div></div></div><div class="pre-nav"><div>2.Sug检索回调与POI检索回调</div></div><div class="pre-wrap"><div class="pre-wrap-nav"><div>Objective-C</div></div><div class="pre-wrap-w pre-wrap-w-ios code_container"><!-- ios示例代码位置 --><pre class="prettyprint prettyprinted pre-ios">#pragma mark - BMKSuggestionSearchDelegate | ||
+ | /// 返回suggestion搜索结果 | ||
+ | /// @param searcher 搜索对象 | ||
+ | /// @param result 搜索结果 | ||
+ | /// @param error BMKSearchErrorCode | ||
+ | - (void)onGetSuggestionResult:(BMKSuggestionSearch *)searcher result:(BMKSuggestionSearchResult *)result errorCode:(BMKSearchErrorCode)error { | ||
+ | if (error == BMK_SEARCH_NO_ERROR) { | ||
+ | self.sugInfoList = [result.suggestionList copy]; | ||
__weak typeof(self) weakSelf = self; | __weak typeof(self) weakSelf = self; | ||
− | |||
dispatch_async(dispatch_get_main_queue(), ^{ | dispatch_async(dispatch_get_main_queue(), ^{ | ||
[weakSelf.tableView reloadData]; | [weakSelf.tableView reloadData]; | ||
}); | }); | ||
} | } | ||
− | } | + | } |
+ | |||
+ | |||
+ | |||
+ | #pragma mark - BMKPoiSearchDelegate | ||
+ | |||
+ | /// 返回POI搜索结果 | ||
+ | /// @param searcher 搜索对象 | ||
+ | /// @param poiResult 搜索结果列表 | ||
+ | /// @param errorCode BMKSearchErrorCode | ||
+ | - (void)onGetPoiResult:(BMKPoiSearch *)searcher result:(BMKPOISearchResult *)poiResult errorCode:(BMKSearchErrorCode)errorCode { | ||
+ | [self.searchView endEditing:YES]; | ||
+ | self.tableView.hidden = YES; | ||
+ | if (errorCode == BMK_SEARCH_NO_ERROR) { | ||
+ | if (!poiResult.poiInfoList || poiResult.poiInfoList.count == 0) { | ||
+ | return; | ||
+ | } | ||
+ | // 移除标注 | ||
+ | [_mapView removeAnnotations:_mapView.annotations]; | ||
+ | |||
+ | _poiInfoList = [poiResult.poiInfoList copy]; | ||
+ | |||
+ | NSMutableArray<BMKPoiAnnotation *> *annotions = [NSMutableArray array]; | ||
+ | for (int i = 0; i < poiResult.poiInfoList.count; i++) { | ||
+ | BMKPoiInfo *info = poiResult.poiInfoList[i]; | ||
+ | BMKPoiAnnotation *annotaion = [[BMKPoiAnnotation alloc] init]; | ||
+ | annotaion.coordinate = info.pt; | ||
+ | annotaion.title = info.name; | ||
+ | annotaion.index = i; | ||
+ | [annotions addObject:annotaion]; | ||
+ | } | ||
+ | |||
+ | // 添加标注 | ||
+ | [_mapView addAnnotations:annotions]; | ||
+ | // 标注适配屏幕 | ||
+ | [self showAnnotations:annotions animated:YES]; | ||
+ | |||
+ | } | ||
+ | } | ||
+ | |||
</pre> | </pre> | ||
− | + | <div class="pre-btn"><div class="pre-btn-copy-ios">复制</div><div class="pre-btn-cb-ios">深色</div></div><div class="success">复制成功</div></div></div></div></div> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | </div> | + |
2023年8月16日 (三) 11:46的最后版本
地点检索
功能场景
支持用户根据关键词查询出行的起终点、兴趣点等,可结合路线规划、导航等功能使用。
Android
iOS
https://mapopen-website-wiki.bj.bcebos.com/demos/AndroidVideos/didianjiansuo_2.mp4
1590746640|//mapopen-website-wiki.bj.bcebos.com/demos/newqrcodes/地点检索@2xanidroid.png
扫码体验
使用产品
Android地图SDK|/index.php?title=androidsdk
>
POI城市检索|/index.php?title=androidsdk/guide/search/poi
Android地图SDK|/index.php?title=androidsdk
>
地点输入提示检索|/index.php?title=androidsdk/guide/search/poi
下载源码
//mapopen-website-wiki.bj.bcebos.com/demos/BaiduMapSDKExample.zip
核心接口
类
接口
描述
PoiSearch
searchInCity(PoiCitySearchOption option)
城市内检索
PoiSearch
setOnGetPoiSearchResultListener(OnGetPoiSearchResultListener poiResultListener)
设置检索结果回调
PoiCitySearchOption
city(String city)
设置检索城市
PoiCitySearchOption
keyword(String key)
搜索关键字
PoiCitySearchOption
cityLimit(boolean cityLimit)
设置区域数据召回限制 为true时,仅召回city对应区域内数据
重点关注
检索完成后需要调用PoiSearch的destroy()方法,否则会有内存泄露。
核心代码
1.发起检索请求
JAVA
// 发起请求 mPoiSearch.searchInCity((new PoiCitySearchOption()) .city(cityStr) .keyword(keyWordStr) .pageNum(mLoadIndex) // 分页编号 .cityLimit(false) .scope(scope));
复制
深色
复制成功
2.检索结果回调处理
JAVA
@Override public void onGetPoiResult(PoiResult poiResult) { if (poiResult == null || poiResult.error == SearchResult.ERRORNO.RESULT_NOT_FOUND) { Toast.makeText(PoiCitySearchActivity.this, "未找到结果", Toast.LENGTH_LONG).show(); return; } List<PoiInfo> poiInfos = poiResult.getAllPoi(); if (null == poiInfos) { return; } // 隐藏之前的 hidePoiInfoLayout(); mRecyclerView.setVisibility(View.VISIBLE); if (null == mPoiItemAdaper) { mPoiItemAdaper = new PoiItemAdapter(poiInfos); } else { mPoiItemAdaper.updateData(poiInfos); } }
复制
深色
复制成功