Java Code Examples for com.amap.api.services.poisearch.PoiSearch#searchPOIAsyn()
The following examples show how to use
com.amap.api.services.poisearch.PoiSearch#searchPOIAsyn() .
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: PoiAroundSearchActivity.java From TraceByAmap with MIT License | 6 votes |
/** * 开始进行poi搜索 */ protected void doSearchQuery() { keyWord = mSearchText.getText().toString().trim(); currentPage = 0; query = new PoiSearch.Query(keyWord, "", "");// 第一个参数表示搜索字符串,第二个参数表示poi搜索类型,第三个参数表示poi搜索区域(空字符串代表全国) query.setPageSize(20);// 设置每页最多返回多少条poiitem query.setPageNum(currentPage);// 设置查第一页 if (lp != null) { poiSearch = new PoiSearch(this, query); poiSearch.setOnPoiSearchListener(this); poiSearch.setBound(new SearchBound(lp, 5000, true));// // 设置搜索区域为以lp点为圆心,其周围5000米范围 poiSearch.searchPOIAsyn();// 异步搜索 } }
Example 2
Source File: MapActivity.java From xposed-rimet with Apache License 2.0 | 5 votes |
/** * 搜索Poi信息 * @param keyWord */ private void doSearchQuery(String keyWord) { mQuery = new PoiSearch.Query(keyWord, "", ""); mQuery.setPageSize(20); mQuery.setPageNum(0); mPoiSearch = new PoiSearch(this, mQuery); mPoiSearch.setOnPoiSearchListener(new MyOnPoiSearchListener()); mPoiSearch.searchPOIAsyn(); }
Example 3
Source File: SubPoiSearchActivity.java From TraceByAmap with MIT License | 5 votes |
private void poi_Search(String str){ PoiSearch.Query mPoiSearchQuery = new PoiSearch.Query(str, "", city); mPoiSearchQuery.requireSubPois(true); //true 搜索结果包含POI父子关系; false mPoiSearchQuery.setPageSize(10); mPoiSearchQuery.setPageNum(0); PoiSearch poiSearch = new PoiSearch(SubPoiSearchActivity.this,mPoiSearchQuery); poiSearch.setOnPoiSearchListener(this); poiSearch.searchPOIAsyn(); }
Example 4
Source File: PoiKeywordSearchActivity.java From TraceByAmap with MIT License | 5 votes |
/** * 开始进行poi搜索 */ protected void doSearchQuery() { showProgressDialog();// 显示进度框 currentPage = 0; query = new PoiSearch.Query(keyWord, "", editCity.getText().toString());// 第一个参数表示搜索字符串,第二个参数表示poi搜索类型,第三个参数表示poi搜索区域(空字符串代表全国) query.setPageSize(10);// 设置每页最多返回多少条poiitem query.setPageNum(currentPage);// 设置查第一页 poiSearch = new PoiSearch(this, query); poiSearch.setOnPoiSearchListener(this); poiSearch.searchPOIAsyn(); }
Example 5
Source File: LocationActivity.java From xmpp with Apache License 2.0 | 5 votes |
protected void doSearchQuery() { currentPage = 0; query = new PoiSearch.Query("", "", "");// query.setPageSize(50);// 设置每页最多返回多少条poiitem query.setPageNum(currentPage);// 设置查询页码 poiSearch = new PoiSearch(this, query);// 初始化poiSearch对象 poiSearch.setBound(new PoiSearch.SearchBound(lp, 20000)); poiSearch.setOnPoiSearchListener(this);// 设置回调数据的监听器 poiSearch.searchPOIAsyn();// 开始搜索 }
Example 6
Source File: FindMapAroundAty.java From myapplication with Apache License 2.0 | 5 votes |
/** * 开始进行poi搜索 */ protected void doSearchQuery(String keyWord, String city) { currentPage = 0; query = new PoiSearch.Query(keyWord, "", city);// 第一个参数表示搜索字符串,第二个参数表示poi搜索类型,第三个参数表示poi搜索区域(空字符串代表全国) query.setPageSize(20);// 设置每页最多返回多少条poiitem query.setPageNum(currentPage);// 设置查第一页 if (lp != null) { poiSearch = new PoiSearch(this, query); poiSearch.setOnPoiSearchListener(this); poiSearch.setBound(new PoiSearch.SearchBound(lp, 5000, true));// // 设置搜索区域为以lp点为圆心,其周围5000米范围 poiSearch.searchPOIAsyn();// 异步搜索 } }
Example 7
Source File: PoiSearchTask.java From Android_UsingCar_Example with Apache License 2.0 | 5 votes |
public void search(String keyWord,String city) { Query query = new PoiSearch.Query(keyWord, "", city); query.setPageSize(10); query.setPageNum(0); PoiSearch poiSearch = new PoiSearch(mContext, query); poiSearch.setOnPoiSearchListener(this); poiSearch.searchPOIAsyn(); }
Example 8
Source File: SearchInteracter.java From BmapLite with GNU General Public License v3.0 | 4 votes |
private void searchPoiNearbyByAmap(MyPoiModel nearby, String keyword, int page, final OnSearchResultListener listener) { PoiSearch.Query query = new PoiSearch.Query(keyword, "", nearby.getCity()); query.setPageSize(20); query.setPageNum(page); PoiSearch.SearchBound bound = new PoiSearch.SearchBound(new LatLonPoint(nearby.getLatitude(), nearby.getLongitude()), 20000); PoiSearch poiSearchAmap = new PoiSearch(mContext, query); poiSearchAmap.setBound(bound); poiSearchAmap.setOnPoiSearchListener(new PoiSearch.OnPoiSearchListener() { @Override public void onPoiSearched(com.amap.api.services.poisearch.PoiResult poiResult, int code) { if (1000 == code) { if (null != poiResult && null != poiResult.getPois() && !poiResult.getPois().isEmpty()) { List<MyPoiModel> list = new ArrayList<>(); for (PoiItem poi : poiResult.getPois()) { MyPoiModel myPoi = new MyPoiModel(mType); myPoi.setCity(poi.getCityName()); myPoi.setUid(poi.getPoiId()); myPoi.setName(poi.getTitle()); myPoi.setInfo(poi.getTel()); myPoi.setAddress(poi.getSnippet()); myPoi.setLatitude(poi.getLatLonPoint().getLatitude()); myPoi.setLongitude(poi.getLatLonPoint().getLongitude()); myPoi.setTypePoi(TypePoi.POINT); list.add(myPoi); } listener.setSearchResult(list); listener.onShowData("search"); } else { listener.onNoData("search"); } } else { listener.onNoData("search"); } } @Override public void onPoiItemSearched(PoiItem poiItem, int i) { } }); poiSearchAmap.searchPOIAsyn(); }
Example 9
Source File: SearchInteracter.java From BmapLite with GNU General Public License v3.0 | 4 votes |
private void searchPoiInCityByAmap(String keyword, String city, int page, final OnSearchResultListener listener) { PoiSearch.Query query = new PoiSearch.Query(keyword, null, city); query.setPageSize(20); query.setPageNum(page); PoiSearch poiSearchAmap = new PoiSearch(mContext, query); poiSearchAmap.setOnPoiSearchListener(new PoiSearch.OnPoiSearchListener() { @Override public void onPoiSearched(com.amap.api.services.poisearch.PoiResult poiResult, int code) { if (null != poiResult && null != poiResult.getPois() && !poiResult.getPois().isEmpty()) { List<MyPoiModel> list = new ArrayList<>(); for (PoiItem poi : poiResult.getPois()) { MyPoiModel myPoi = new MyPoiModel(mType); myPoi.setCity(poi.getCityName()); myPoi.setUid(poi.getPoiId()); myPoi.setName(poi.getTitle()); myPoi.setAddress(poi.getSnippet()); myPoi.setInfo(poi.getTel()); myPoi.setLatitude(poi.getLatLonPoint().getLatitude()); myPoi.setLongitude(poi.getLatLonPoint().getLongitude()); myPoi.setTypePoi(TypePoi.POINT); list.add(myPoi); } listener.setSearchResult(list); listener.onShowData("search"); } else { listener.onNoData("search"); } if (null != poiResult && null != poiResult.getSearchSuggestionCitys() && !poiResult.getSearchSuggestionCitys().isEmpty()) { listener.setSuggestCityList(poiResult.getSearchSuggestionCitys()); }else { listener.onNoData("city"); } } @Override public void onPoiItemSearched(PoiItem poiItem, int i) { } }); poiSearchAmap.searchPOIAsyn(); }
Example 10
Source File: SearchInteracter.java From BmapLite with Apache License 2.0 | 4 votes |
private void searchPoiNearbyByAmap(MyPoiModel nearby, String keyword, int page, final OnSearchResultListener listener) { PoiSearch.Query query = new PoiSearch.Query(keyword, "", nearby.getCity()); query.setPageSize(20); query.setPageNum(page); PoiSearch.SearchBound bound = new PoiSearch.SearchBound(new LatLonPoint(nearby.getLatitude(), nearby.getLongitude()), 20000); PoiSearch poiSearchAmap = new PoiSearch(mContext, query); poiSearchAmap.setBound(bound); poiSearchAmap.setOnPoiSearchListener(new PoiSearch.OnPoiSearchListener() { @Override public void onPoiSearched(com.amap.api.services.poisearch.PoiResult poiResult, int code) { if (1000 == code) { if (null != poiResult && null != poiResult.getPois() && !poiResult.getPois().isEmpty()) { List<MyPoiModel> list = new ArrayList<>(); for (PoiItem poi : poiResult.getPois()) { MyPoiModel myPoi = new MyPoiModel(mType); myPoi.setCity(poi.getCityName()); myPoi.setUid(poi.getPoiId()); myPoi.setName(poi.getTitle()); myPoi.setInfo(poi.getTel()); myPoi.setAddress(poi.getSnippet()); myPoi.setLatitude(poi.getLatLonPoint().getLatitude()); myPoi.setLongitude(poi.getLatLonPoint().getLongitude()); myPoi.setTypePoi(TypePoi.POINT); list.add(myPoi); } listener.setSearchResult(list); listener.onShowData("search"); } else { listener.onNoData("search"); } } else { listener.onNoData("search"); } } @Override public void onPoiItemSearched(PoiItem poiItem, int i) { } }); poiSearchAmap.searchPOIAsyn(); }
Example 11
Source File: SearchInteracter.java From BmapLite with Apache License 2.0 | 4 votes |
private void searchPoiInCityByAmap(String keyword, String city, int page, final OnSearchResultListener listener) { PoiSearch.Query query = new PoiSearch.Query(keyword, null, city); query.setPageSize(20); query.setPageNum(page); PoiSearch poiSearchAmap = new PoiSearch(mContext, query); poiSearchAmap.setOnPoiSearchListener(new PoiSearch.OnPoiSearchListener() { @Override public void onPoiSearched(com.amap.api.services.poisearch.PoiResult poiResult, int code) { if (null != poiResult && null != poiResult.getPois() && !poiResult.getPois().isEmpty()) { List<MyPoiModel> list = new ArrayList<>(); for (PoiItem poi : poiResult.getPois()) { MyPoiModel myPoi = new MyPoiModel(mType); myPoi.setCity(poi.getCityName()); myPoi.setUid(poi.getPoiId()); myPoi.setName(poi.getTitle()); myPoi.setAddress(poi.getSnippet()); myPoi.setInfo(poi.getTel()); myPoi.setLatitude(poi.getLatLonPoint().getLatitude()); myPoi.setLongitude(poi.getLatLonPoint().getLongitude()); myPoi.setTypePoi(TypePoi.POINT); list.add(myPoi); } listener.setSearchResult(list); listener.onShowData("search"); } else { listener.onNoData("search"); } if (null != poiResult && null != poiResult.getSearchSuggestionCitys() && !poiResult.getSearchSuggestionCitys().isEmpty()) { listener.setSuggestCityList(poiResult.getSearchSuggestionCitys()); }else { listener.onNoData("city"); } } @Override public void onPoiItemSearched(PoiItem poiItem, int i) { } }); poiSearchAmap.searchPOIAsyn(); }