高德地图 逆地理编码异步查询

/**
     * 逆地理编码异步查询
     *
     * @param latitude
     * @param longitude
     */
    public void getAddressByLatlng(double latitude, double longitude) {
        final GeocodeSearch geocodeSearch = new GeocodeSearch(getActivity());
        geocodeSearch.setOnGeocodeSearchListener(new GeocodeSearch.OnGeocodeSearchListener() {
            @Override
            public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i) {
                RegeocodeAddress regeocodeAddress = regeocodeResult.getRegeocodeAddress();
                String formatAddress = regeocodeAddress.getFormatAddress();
                String adCode = regeocodeAddress.getAdCode();
                String city = regeocodeAddress.getCity();
                String cityCode = regeocodeAddress.getCityCode();
                String district = regeocodeAddress.getDistrict();
            }
            @Override
            public void onGeocodeSearched(GeocodeResult geocodeResult, int i) {
            }
        });
        //逆地理编码查询条件:逆地理编码查询的地理坐标点、查询范围、坐标类型。
        LatLonPoint latLonPoint = new LatLonPoint(latitude, longitude);
        RegeocodeQuery query = new RegeocodeQuery(latLonPoint, 10f, GeocodeSearch.AMAP);
        //异步查询
        geocodeSearch.getFromLocationAsyn(query);
    }

你可能感兴趣的:(高德地图 逆地理编码异步查询)