Search in sources :

Example 1 with Location

use of com.here.android.mpa.search.Location in project here-android-sdk-examples by heremaps.

the class MainView method triggerRevGeocodeRequest.

private void triggerRevGeocodeRequest() {
    m_resultTextView.setText("");
    /* Create a ReverseGeocodeRequest object with a GeoCoordinate. */
    GeoCoordinate coordinate = new GeoCoordinate(49.25914, -123.00777);
    ReverseGeocodeRequest revGecodeRequest = new ReverseGeocodeRequest(coordinate);
    revGecodeRequest.execute(new ResultListener<Location>() {

        @Override
        public void onCompleted(Location location, ErrorCode errorCode) {
            if (errorCode == ErrorCode.NONE) {
                /*
                     * From the location object, we retrieve the address and display to the screen.
                     * Please refer to HERE Android SDK doc for other supported APIs.
                     */
                updateTextView(location.getAddress().toString());
            } else {
                updateTextView("ERROR:RevGeocode Request returned error code:" + errorCode);
            }
        }
    });
}
Also used : GeoCoordinate(com.here.android.mpa.common.GeoCoordinate) ReverseGeocodeRequest(com.here.android.mpa.search.ReverseGeocodeRequest) ErrorCode(com.here.android.mpa.search.ErrorCode) Location(com.here.android.mpa.search.Location)

Aggregations

GeoCoordinate (com.here.android.mpa.common.GeoCoordinate)1 ErrorCode (com.here.android.mpa.search.ErrorCode)1 Location (com.here.android.mpa.search.Location)1 ReverseGeocodeRequest (com.here.android.mpa.search.ReverseGeocodeRequest)1