com.amap.api.services.geocoder.RegeocodeResult Java Examples

The following examples show how to use com.amap.api.services.geocoder.RegeocodeResult. 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: ReGeocoderActivity.java    From TraceByAmap with MIT License 6 votes vote down vote up
/**
 * 逆地理编码回调
 */
@Override
public void onRegeocodeSearched(RegeocodeResult result, int rCode) {
	dismissDialog();
	if (rCode == AMapException.CODE_AMAP_SUCCESS) {
		if (result != null && result.getRegeocodeAddress() != null
				&& result.getRegeocodeAddress().getFormatAddress() != null) {
			addressName = result.getRegeocodeAddress().getFormatAddress()
					+ "附近";
			aMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
					AMapUtil.convertToLatLng(latLonPoint), 15));
			regeoMarker.setPosition(AMapUtil.convertToLatLng(latLonPoint));
			ToastUtil.show(ReGeocoderActivity.this, addressName);
		} else {
			ToastUtil.show(ReGeocoderActivity.this, R.string.no_result);
		}
	} else {
		ToastUtil.showerror(this, rCode);
	}
}
 
Example #2
Source File: AMAPLocationActivity.java    From sealtalk-android with MIT License 6 votes vote down vote up
@Override
public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i) {
    if (i == 0) {
        if (regeocodeResult != null && regeocodeResult.getRegeocodeAddress() != null) {
            endAnim();
            centerMarker.setIcon(successDescripter);
            RegeocodeAddress regeocodeAddress = regeocodeResult.getRegeocodeAddress();
            String formatAddress = regeocodeResult.getRegeocodeAddress().getFormatAddress();
            String shortAdd = formatAddress.replace(regeocodeAddress.getProvince(), "").replace(regeocodeAddress.getCity(), "").replace(regeocodeAddress.getDistrict(), "");
            tvCurLocation.setText(shortAdd);
            double latitude = regeocodeResult.getRegeocodeQuery().getPoint().getLatitude();
            double longitude = regeocodeResult.getRegeocodeQuery().getPoint().getLongitude();
            mMsg = LocationMessage.obtain(latitude, longitude, shortAdd, getMapUrl(latitude, longitude));
            NLog.e("LocationChange", shortAdd + latitude + "----" + longitude);
        } else {
            NToast.shortToast(AMAPLocationActivity.this, "没有搜索到结果");
        }
    } else {
        NToast.shortToast(AMAPLocationActivity.this, "搜索失败,请检查网络");
    }
}
 
Example #3
Source File: AmapActivity.java    From sealtalk-android with MIT License 6 votes vote down vote up
@Override
    public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i) {
        if(i == 0){
            if(regeocodeResult != null&& regeocodeResult.getRegeocodeAddress() != null){
                endAnim();
                centerMarker.setIcon(successDescripter);
                RegeocodeAddress regeocodeAddress = regeocodeResult.getRegeocodeAddress();
                String formatAddress = regeocodeResult.getRegeocodeAddress().getFormatAddress();
                String shortAdd = formatAddress.replace(regeocodeAddress.getProvince(), "").replace(regeocodeAddress.getCity(), "").replace(regeocodeAddress.getDistrict(), "");
                tvCurLocation.setText(shortAdd);
            }else{
//                ToastUtil.show(AmapActivity.this, R.string.no_result);
            }
        }else{
//            ToastUtil.show(AmapActivity.this, R.string.error_network);
        }
    }
 
Example #4
Source File: RegeocodeTask.java    From Android_UsingCar_Example with Apache License 2.0 6 votes vote down vote up
@Override
public void onRegeocodeSearched(RegeocodeResult regeocodeReult,
		int resultCode) {
	if (resultCode == 0) {
		if (regeocodeReult != null
				&& regeocodeReult.getRegeocodeAddress() != null
				&& mOnLocationGetListener != null) {
			String address = regeocodeReult.getRegeocodeAddress()
					.getFormatAddress();
			String city = regeocodeReult.getRegeocodeAddress().getCityCode();
	 
			PositionEntity entity = new PositionEntity();
			entity.address = address;
			entity.city = city;
			mOnLocationGetListener.onRegecodeGet(entity);

		}
	}
	//TODO 可以根据app自身需求对查询错误情况进行相应的提示或者逻辑处理
}
 
Example #5
Source File: MapActivity.java    From xposed-rimet with Apache License 2.0 5 votes vote down vote up
@Override
public void onRegeocodeSearched(RegeocodeResult result, int resultCode) {

    if (resultCode != AMapException.CODE_AMAP_SUCCESS) {
        Alog.e("搜索出错了");
        return;
    }

    if (result == null
            || result.getRegeocodeAddress() == null
            || result.getRegeocodeAddress().getPois() == null) {
        Alog.e("没有搜索结果!");
        ToastUtil.show("没有搜索结果!");
        return;
    }

    RegeocodeAddress regeocodeAddress = result.getRegeocodeAddress();

    // 当前位置
    PoiItem curPoiItem = new PoiItem(
            "regeo", mSearchLatLonPoint, "标记的位置", regeocodeAddress.getFormatAddress());


    List<PoiItem> tmpList = new ArrayList<>();
    tmpList.add(curPoiItem);
    tmpList.addAll(regeocodeAddress.getPois());

    ViewUtil.setVisibility(mTvPrompt, View.GONE);
    mSearchResultAdapter.setBeginAddress(regeocodeAddress.getProvince() + regeocodeAddress.getCity() + regeocodeAddress.getDistrict());
    mSearchResultAdapter.setSelectedPosition(0);
    mSearchResultAdapter.setItems(tmpList);
    mSearchResultAdapter.notifyDataSetChanged();
}
 
Example #6
Source File: FlutterAMapConvertRegister.java    From flutter_amap_plugin with MIT License 5 votes vote down vote up
@Override
public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i) {
    if (i == 1000) {
        Map<String, Object> map = new HashMap<>();
        map.put("address", regeocodeResult.getRegeocodeAddress().getFormatAddress());
        FlutterAmapPlugin.convertChannel.invokeMethod("onCoordinateToGeo", map);
    } else {
        FlutterAmapPlugin.locChannel.invokeMethod("onConvertError",
                "坐标转地址错误:{" + i + " - 未发现有效地址}");
    }
}
 
Example #7
Source File: AutoScheduleAssistFragment.java    From BetterWay with Apache License 2.0 5 votes vote down vote up
@Override
public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i) {
    LogUtil.e(TAG, "onRegeocodeSearched");
    String getLocation = regeocodeResult.getRegeocodeAddress().getProvince()
                + regeocodeResult.getRegeocodeAddress().getCity();
    sendSearchLocation(regeocodeResult.getRegeocodeAddress().getCity());
    mLocationText.setText(getLocation);
}
 
Example #8
Source File: PlaceLocationSelectActivity.java    From Fishing with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i) {
    address.setText(regeocodeResult.getRegeocodeAddress().getFormatAddress());
    mAddress = regeocodeResult.getRegeocodeAddress().getFormatAddress();
    mBriefAddress = regeocodeResult.getRegeocodeAddress().getTownship();
    Uri uri = Uri.parse("http://m.amap.com/navi").buildUpon()
            .appendQueryParameter("dest",LocationModel.getInstance().getCurLocation().getLatitude()+","+LocationModel.getInstance().getCurLocation().getLongitude())
            .appendQueryParameter("destName",mAddress)
            .appendQueryParameter("hideRouteIcon","1")
            .appendQueryParameter("key","474871845dfffa03a26cfcb0ab4fb4f1")
            .build();
    locationMessage = LocationMessage.obtain(LocationModel.getInstance().getCurLocation().getLatitude(),LocationModel.getInstance().getCurLocation().getLongitude(),
            mAddress, uri);
}
 
Example #9
Source File: GeocoderActivity.java    From TraceByAmap with MIT License 4 votes vote down vote up
/**
 * 逆地理编码回调
 */
@Override
public void onRegeocodeSearched(RegeocodeResult result, int rCode) {
	
}
 
Example #10
Source File: WritePresenter.java    From Fishing with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i) {
    address = regeocodeResult.getRegeocodeAddress().getTownship();
    getView().showAddress(address);
}