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

The following examples show how to use com.amap.api.services.geocoder.GeocodeAddress. 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: GeocoderActivity.java    From TraceByAmap with MIT License 6 votes vote down vote up
/**
 * 地理编码查询回调
 */
@Override
public void onGeocodeSearched(GeocodeResult result, int rCode) {
	dismissDialog();
	if (rCode == AMapException.CODE_AMAP_SUCCESS) {
		if (result != null && result.getGeocodeAddressList() != null
				&& result.getGeocodeAddressList().size() > 0) {
			GeocodeAddress address = result.getGeocodeAddressList().get(0);

			if(address != null) {
				aMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
						AMapUtil.convertToLatLng(address.getLatLonPoint()), 15));
				geoMarker.setPosition(AMapUtil.convertToLatLng(address
						.getLatLonPoint()));
				addressName = "经纬度值:" + address.getLatLonPoint() + "\n位置描述:"
						+ address.getFormatAddress();
				ToastUtil.show(GeocoderActivity.this, addressName);
			}
		} else {
			ToastUtil.show(GeocoderActivity.this, R.string.no_result);
		}
	} else {
		ToastUtil.showerror(this, rCode);
	}
}
 
Example #2
Source File: AutoScheduleAssistFragment.java    From BetterWay with Apache License 2.0 5 votes vote down vote up
@Override
public void onGeocodeSearched(GeocodeResult geocodeResult, int i) {
    LogUtil.e(TAG, "onGeocodeSearched");
    GeocodeAddress geocodeAddress = geocodeResult.getGeocodeAddressList().get(0);
    LatLng latLng = new LatLng(geocodeAddress.getLatLonPoint().getLatitude(),
            geocodeAddress.getLatLonPoint().getLongitude());
    aMap.moveCamera(CameraUpdateFactory.changeLatLng(latLng));
}