Created
November 8, 2012 13:42
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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