Java Code Examples for com.amap.api.services.geocoder.RegeocodeResult#getRegeocodeAddress()

The following examples show how to use com.amap.api.services.geocoder.RegeocodeResult#getRegeocodeAddress() . 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();
}