use of com.here.android.mpa.search.GeocodeRequest in project here-android-sdk-examples by heremaps.
the class MainView method triggerGeocodeRequest.
private void triggerGeocodeRequest() {
m_resultTextView.setText("");
/*
* Create a GeocodeRequest object with the desired query string, then set the search area by
* providing a GeoCoordinate and radius before executing the request.
*/
String query = "4350 Still Creek Dr,Burnaby";
GeocodeRequest geocodeRequest = new GeocodeRequest(query);
GeoCoordinate coordinate = new GeoCoordinate(49.266787, -123.056640);
geocodeRequest.setSearchArea(coordinate, 5000);
geocodeRequest.execute(new ResultListener<List<GeocodeResult>>() {
@Override
public void onCompleted(List<GeocodeResult> results, ErrorCode errorCode) {
if (errorCode == ErrorCode.NONE) {
/*
* From the result object, we retrieve the location and its coordinate and
* display to the screen. Please refer to HERE Android SDK doc for other
* supported APIs.
*/
StringBuilder sb = new StringBuilder();
for (GeocodeResult result : results) {
sb.append(result.getLocation().getCoordinate().toString());
sb.append("\n");
}
updateTextView(sb.toString());
} else {
updateTextView("ERROR:Geocode Request returned error code:" + errorCode);
}
}
});
}
Aggregations