com.baidu.mapapi.search.poi.OnGetPoiSearchResultListener Java Examples

The following examples show how to use com.baidu.mapapi.search.poi.OnGetPoiSearchResultListener. 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: SearchInteracter.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
private void getPoiDetailsByBaidu(String uid, OnBaseListener listener) {
    mPoiSearchBaidu.setOnGetPoiSearchResultListener(new OnGetPoiSearchResultListener() {
        @Override
        public void onGetPoiResult(PoiResult poiResult) {
        }

        @Override
        public void onGetPoiDetailResult(PoiDetailResult poiDetailResult) {
        }

        @Override
        public void onGetPoiIndoorResult(PoiIndoorResult poiIndoorResult) {

        }
    });
    mPoiSearchBaidu.searchPoiDetail(new PoiDetailSearchOption().poiUid(uid));
}
 
Example #2
Source File: SearchInteracter.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
private void getPoiDetailsByBaidu(String uid, OnBaseListener listener) {
    mPoiSearchBaidu.setOnGetPoiSearchResultListener(new OnGetPoiSearchResultListener() {
        @Override
        public void onGetPoiResult(PoiResult poiResult) {
        }

        @Override
        public void onGetPoiDetailResult(PoiDetailResult poiDetailResult) {
        }

        @Override
        public void onGetPoiIndoorResult(PoiIndoorResult poiIndoorResult) {

        }
    });
    mPoiSearchBaidu.searchPoiDetail(new PoiDetailSearchOption().poiUid(uid));
}
 
Example #3
Source File: MainActivity.java    From MoveMapLocation with Apache License 2.0 5 votes vote down vote up
/**
 * 输入框监听---输入完毕
 *
 * @param s
 */
@Override
public void afterTextChanged(Editable s) {
    if (s.length() == 0 || "".equals(s.toString())) {
        searchPois.setVisibility(View.GONE);
    } else {
        //创建PoiSearch实例
        PoiSearch poiSearch = PoiSearch.newInstance();
        //城市内检索
        PoiCitySearchOption poiCitySearchOption = new PoiCitySearchOption();
        //关键字
        poiCitySearchOption.keyword(s.toString());
        //城市
        poiCitySearchOption.city(city);
        //设置每页容量,默认为每页10条
        poiCitySearchOption.pageCapacity(10);
        //分页编号
        poiCitySearchOption.pageNum(1);
        poiSearch.searchInCity(poiCitySearchOption);
        //设置poi检索监听者
        poiSearch.setOnGetPoiSearchResultListener(new OnGetPoiSearchResultListener() {
            //poi 查询结果回调
            @Override
            public void onGetPoiResult(PoiResult poiResult) {
                List<PoiInfo> poiInfos = poiResult.getAllPoi();
                PoiSearchAdapter poiSearchAdapter = new PoiSearchAdapter(MainActivity.this, poiInfos, locationLatLng);
                searchPois.setVisibility(View.VISIBLE);
                searchPois.setAdapter(poiSearchAdapter);
            }

            //poi 详情查询结果回调
            @Override
            public void onGetPoiDetailResult(PoiDetailResult poiDetailResult) {
            }
        });
    }
}
 
Example #4
Source File: SearchInteracter.java    From BmapLite with GNU General Public License v3.0 4 votes vote down vote up
private void searchPoiNearbyByBaidu(MyPoiModel nearby, String keyword, int page, final OnSearchResultListener listener) {
    mPoiSearchBaidu.setOnGetPoiSearchResultListener(new OnGetPoiSearchResultListener() {
        @Override
        public void onGetPoiResult(PoiResult poiResult) {
            if (null != poiResult && null != poiResult.getAllPoi() && !poiResult.getAllPoi().isEmpty()) {
                List<MyPoiModel> list = new ArrayList<>();

                for (PoiInfo poi : poiResult.getAllPoi()) {
                    MyPoiModel myPoi = new MyPoiModel(mType);
                    myPoi.setCity(poi.city);
                    myPoi.setUid(poi.uid);
                    myPoi.setAddress(poi.address);
                    myPoi.setName(poi.name);
                    myPoi.setInfo(poi.phoneNum);
                    if (null != poi.location) {
                        myPoi.setLatitude(poi.location.latitude);
                        myPoi.setLongitude(poi.location.longitude);
                    }
                    if (poi.type == PoiInfo.POITYPE.BUS_LINE) {
                        myPoi.setTypePoi(TypePoi.BUS_LINE);
                    } else if (poi.type == PoiInfo.POITYPE.SUBWAY_LINE) {
                        myPoi.setTypePoi(TypePoi.SUBWAY_LINE);
                    } else if (poi.type == PoiInfo.POITYPE.BUS_STATION) {
                        myPoi.setTypePoi(TypePoi.BUS_STATION);
                    } else if (poi.type == PoiInfo.POITYPE.SUBWAY_STATION) {
                        myPoi.setTypePoi(TypePoi.SUBWAY_STATION);
                    } else if (poi.type == PoiInfo.POITYPE.POINT) {
                        myPoi.setTypePoi(TypePoi.POINT);
                    }

                    list.add(myPoi);
                }
                listener.setSearchResult(list);
                listener.onShowData("search");
            } else {
                listener.onNoData("search");
            }
        }

        @Override
        public void onGetPoiDetailResult(PoiDetailResult poiDetailResult) {

        }

        @Override
        public void onGetPoiIndoorResult(PoiIndoorResult poiIndoorResult) {

        }
    });

    mPoiSearchBaidu.searchNearby(new PoiNearbySearchOption().location(new LatLng(nearby.getLatitude(), nearby.getLongitude())).keyword(keyword).radius(20000).sortType(PoiSortType.distance_from_near_to_far).pageNum(page).pageCapacity(20));
}
 
Example #5
Source File: SearchInteracter.java    From BmapLite with Apache License 2.0 4 votes vote down vote up
private void searchPoiNearbyByBaidu(MyPoiModel nearby, String keyword, int page, final OnSearchResultListener listener) {
    mPoiSearchBaidu.setOnGetPoiSearchResultListener(new OnGetPoiSearchResultListener() {
        @Override
        public void onGetPoiResult(PoiResult poiResult) {
            if (null != poiResult && null != poiResult.getAllPoi() && !poiResult.getAllPoi().isEmpty()) {
                List<MyPoiModel> list = new ArrayList<>();

                for (PoiInfo poi : poiResult.getAllPoi()) {
                    MyPoiModel myPoi = new MyPoiModel(mType);
                    myPoi.setCity(poi.city);
                    myPoi.setUid(poi.uid);
                    myPoi.setAddress(poi.address);
                    myPoi.setName(poi.name);
                    myPoi.setInfo(poi.phoneNum);
                    if (null != poi.location) {
                        myPoi.setLatitude(poi.location.latitude);
                        myPoi.setLongitude(poi.location.longitude);
                    }
                    if (poi.type == PoiInfo.POITYPE.BUS_LINE) {
                        myPoi.setTypePoi(TypePoi.BUS_LINE);
                    } else if (poi.type == PoiInfo.POITYPE.SUBWAY_LINE) {
                        myPoi.setTypePoi(TypePoi.SUBWAY_LINE);
                    } else if (poi.type == PoiInfo.POITYPE.BUS_STATION) {
                        myPoi.setTypePoi(TypePoi.BUS_STATION);
                    } else if (poi.type == PoiInfo.POITYPE.SUBWAY_STATION) {
                        myPoi.setTypePoi(TypePoi.SUBWAY_STATION);
                    } else if (poi.type == PoiInfo.POITYPE.POINT) {
                        myPoi.setTypePoi(TypePoi.POINT);
                    }

                    list.add(myPoi);
                }
                listener.setSearchResult(list);
                listener.onShowData("search");
            } else {
                listener.onNoData("search");
            }
        }

        @Override
        public void onGetPoiDetailResult(PoiDetailResult poiDetailResult) {

        }

        @Override
        public void onGetPoiIndoorResult(PoiIndoorResult poiIndoorResult) {

        }
    });

    mPoiSearchBaidu.searchNearby(new PoiNearbySearchOption().location(new LatLng(nearby.getLatitude(), nearby.getLongitude())).keyword(keyword).radius(20000).sortType(PoiSortType.distance_from_near_to_far).pageNum(page).pageCapacity(20));
}