Skip to content

Instantly share code, notes, and snippets.

@ignaciogs
Created November 8, 2012 13:42
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 ignaciogs/4038861 to your computer and use it in GitHub Desktop.
Save ignaciogs/4038861 to your computer and use it in GitHub Desktop.
Returns conditions (the current temperature, weather condition, humidity, wind, 'feels like' temperature, barometric pressure, and visibility from Weather Underground's Weather API) for a given latitude and longitude
GeoPoint center = mapView.getMapCenter();
WundergroundApiProvider.getClient().query(new ContextAwareAPIDelegate<WundergroundResponse>(MainActivity.this, WundergroundResponse.class, RequestCache.LoadPolicy.NEVER) {
@Override
public void onResults(WundergroundResponse wundergroundResponse) {
Toast.makeText(MyActivity.this, wundergroundResponse.getCurrentObservation().getWeather(), Toast.LENGTH_LONG).show();
}
@Override
public void onError(Throwable e) {
Toast.makeText(MyActivity.this, "fail", Toast.LENGTH_LONG).show();
}
}, "Your API Key", Query.latLng(center.getLatitudeE6() / 1E6, center.getLongitudeE6() / 1E6), Feature.conditions, Feature.astronomy);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment