package com.nikolak.weatherapp.ForecastIO;



import android.util.Log;

import org.json.JSONException;
import org.json.JSONObject;

public class Forecast {
    public Currently currently = new Currently();
    public Minutely minutely = new Minutely();
    public Hourly hourly = new Hourly();
    public Daily daily = new Daily();

    private ForecastAPI forecastAPI = new ForecastAPI();

    public Boolean updateForecast(String lat, String lon) throws JSONException {
        JSONObject response = forecastAPI.getDefault(lat, lon);
        if (response==null) {
            return false;
        }

        JSONObject currentlyJObject = response.getJSONObject("currently");
        this.currently.ConstructFromJson(currentlyJObject);

        try{
            JSONObject minutelyJObject = response.getJSONObject("minutely");
            if (minutelyJObject!=null){
                minutely.constructFromJson(minutelyJObject);
            } else{
                minutely = null;
            }
        } catch (JSONException e){
            Log.d("Json", "Minutely not available");
        }

        JSONObject hourlyJObject = response.getJSONObject("hourly");
        this.hourly.constructFromJson(hourlyJObject);
        return true;
    }


}

@@ -38,17 +38,16 @@
 stIO;%0A%0A%0A
-%0A
 import a
@@ -552,10 +552,12 @@
 onse
+ 
 ==
+ 
 null
@@ -744,16 +744,17 @@
      try
+ 
 %7B%0A      
@@ -859,15 +859,18 @@
 ject
+ 
 !=
+ 
 null)
+ 
 %7B%0A  
@@ -946,16 +946,17 @@
   %7D else
+ 
 %7B%0A      
@@ -1029,16 +1029,17 @@
 ption e)
+ 
 %7B%0A      
@@ -1161,24 +1161,24 @@
 (%22hourly%22);%0A
-
         this
@@ -1211,32 +1211,151 @@
 hourlyJObject);%0A
+%0A        JSONObject dailyObject = response.getJSONObject(%22daily%22);%0A        this.daily.constructFromJson(dailyObject);%0A%0A
         return t

Add Daily forecast class initalization and parsing