Weather library

Weatherlib
Historical weather data




Introduction

This feature of Android Weatherlib helps you to get historical weather.
The Daily forecast features is supported by:

Openweathermap Yes
Weatherunderground
Weather.com
Yes
Yahoo! Weather NO
Forecast.io NO

Be aware this feature is not supported by all the provider managed by Weatherlib.

Get Historical Weather in Android

Always let us suppose, you have already city id, then:
       weatherClient.getHistoricalWeather(new WeatherRequest(cityId), 
                      new Date(), // Start date,
                      new Date(), //end date
                      new WeatherClient.HistoricalWeatherEventListener() {
            @Override
            public void onWeatherRetrieved(HistoricalWeather historicalWeather) {
                
            }

            @Override
            public void onWeatherError(WeatherLibException e) {

            }

            @Override
            public void onConnectionError(Throwable throwable) {

            }
        });

In this case, the method accepts two java.util.Date. These dates represent the time interval to use when querying the historical weather information.
Once we have our HistoricalWeather object, it is possible to traverse it:

 List histData = historicalWeather.getHoistoricalData();
 for (HistoricalHourWeather histHour : histData) {
       Weather weather = histHour.weather;
       long timestamp = histHour.timestamp;
 }

We can use the List containing the weather info to create an Android ListView, maybe coding a custom adapter.