Skip to content

Instantly share code, notes, and snippets.

@here-devblog-gists
Created April 21, 2016 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save here-devblog-gists/4204c4dc003b5318eb67af3bd2a5eb45 to your computer and use it in GitHub Desktop.
Save here-devblog-gists/4204c4dc003b5318eb67af3bd2a5eb45 to your computer and use it in GitHub Desktop.
public void findPlaces(View view) {
// collect data to set options
GeoCoordinate myLocation = posManager.getPosition().getCoordinate();
EditText editSteps = (EditText)findViewById(R.id.editSteps);
int noOfSteps;
try {
noOfSteps = Integer.valueOf(editSteps.getText().toString());
} catch (NumberFormatException e) {
// if input is not a number set to default of 2500
noOfSteps = 2500;
}
range = ((noOfSteps * 0.762f) / 2);
// create an exploreRequest and set options
ExploreRequest request = new ExploreRequest();
request.setSearchArea(myLocation, (int)range);
request.setCollectionSize(50);
request.setCategoryFilter(new CategoryFilter().add(Category.Global.SIGHTS_MUSEUMS));
try {
ErrorCode error = request.execute(new SearchRequestListener());
if( error != ErrorCode.NONE ) {
// Handle request error
}
} catch (IllegalArgumentException ex) {
// Handle invalid create search request parameters
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment