private Forecast parseForecastData(String jsonData) throws JSONException { Forecast forecast = new Forecast(); forecast.setCurrentWeather(getCurrentData(jsonData)); forecast.setDailyWeathers(getDailyWeather(jsonData)); forecast.setHourlyWeathers(getHourlyWeather(jsonData)); return forecast; }
private void updateDisplay() { CurrentWeather mCurrentWeather = mForecast.getCurrentWeather(); mTimeLabel.setText("At " + mCurrentWeather.getFormattedTime() + " it will be"); mTempratureLabel.setText(mCurrentWeather.getTempInCelcius() + ""); mHumidityValue.setText(mCurrentWeather.getHumidity() + ""); mPrecipValue.setText(mCurrentWeather.getChanceOfRain() + "%"); mSummary.setText("The weather is " + mCurrentWeather.getSummary()); Drawable drawable = getResources().getDrawable(mCurrentWeather.getIconId()); mIconImage.setImageDrawable(drawable); }
@OnClick(R.id.hourlyButton) public void startHourlyActivity(View view) { Intent intent = new Intent(this, HourlyForecastActivity.class); intent.putExtra(HOURLY_FORECAST, mForecast.getHourlyWeathers()); startActivity(intent); }