Beispiel #1
0
  private Forecast parseForecast(String jsonData) throws JSONException {

    Forecast forecast = new Forecast();
    forecast.setCurrent(getCurrentDetails(jsonData));
    forecast.setHourlyForecast(getHourlyForecast(jsonData));
    forecast.setDailyForecast(getDailyForecast(jsonData));

    return forecast;
  }
Beispiel #2
0
  private void updateDisplay() {

    Current current = mForecast.getCurrent();

    mTemperatureLabel.setText(current.getTemperature() + "");
    mSummaryLabel.setText(current.getSummary());
    mTimeLabel.setText(current.getFormattedTime());
    mHumidityValue.setText(current.getHumidity() + "");
    mPrecipValue.setText(current.getPrecipChance() + "%");
    mLocationLabel.setText(current.getTimeZone());
    mIconImageView.setImageResource(current.getIconId());
  }
Beispiel #3
0
 public void startHourlyActivity(View view) {
   Intent intent = new Intent(this, HourlyForecastActivity.class);
   intent.putExtra(HOURLY_FORECAST, mForecast.getHourlyForecast());
   startActivity(intent);
 }
Beispiel #4
0
 public void startDailyActivity(View view) {
   Intent intent = new Intent(this, DailyForecastActivity.class);
   intent.putExtra(DAILY_FORECAST, mForecast.getDailyForecast());
   startActivity(intent);
 }