app/src/main/java/com/codepath/apps/restclienttemplate/models/Tweet.java
public static Tweet fromJSON(JSONObject jsonObject) throws JSONException {
        Tweet tweet = new Tweet();
        //what does static do?
        //extract the values from JSON
        tweet.body = jsonObject.getString("text");
        tweet.uid = jsonObject.getLong("id");
        tweet.createdAt = jsonObject.getString("created_at");
        tweet.retweet = jsonObject.getInt("retweet_count");
        tweet.favorite = jsonObject.getInt("favorite_count");
        //gets JSON object associated with the string
        tweet.user = User.fromJSON(jsonObject.getJSONObject("user"));
        JSONObject obj = jsonObject.getJSONObject("entities");
        if (obj.has("media")) {
            tweet.image = obj.getJSONArray("media").getJSONObject(0).getString("media_url_https");
        }else {
            tweet.image = "";
        }

        return tweet;
    }
//basically converts JSON data to Tweet
basically converts JSON data to Tweet
basically converts JSON data to Tweet
public static Tweet fromJSON(JSONObject jsonObject) throws JSONException {
        Tweet tweet = new Tweet();
        tweet.body = jsonObject.getString("text");
        tweet.uid = jsonObject.getLong("id");
        tweet.createdAt = jsonObject.getString("created_at");
        tweet.retweet = jsonObject.getInt("retweet_count");
        tweet.favorite = jsonObject.getInt("favorite_count");
        tweet.user = User.fromJSON(jsonObject.getJSONObject("user"));
        JSONObject obj = jsonObject.getJSONObject("entities");
        if (obj.has("media")) {
            tweet.image = obj.getJSONArray("media").getJSONObject(0).getString("media_url_https");
        }else {
            tweet.image = "";
        }
        return tweet;
    }
public static Tweet fromJSON ( JSONObject jsonObject ) throws JSONException { Tweet tweet = new Tweet ( ) ; tweet . body = jsonObject . getString ( "text" ) ; tweet . uid = jsonObject . getLong ( "id" ) ; tweet . createdAt = jsonObject . getString ( "created_at" ) ; tweet . retweet = jsonObject . getInt ( "retweet_count" ) ; tweet . favorite = jsonObject . getInt ( "favorite_count" ) ; tweet . user = User . fromJSON ( jsonObject . getJSONObject ( "user" ) ) ; JSONObject obj = jsonObject . getJSONObject ( "entities" ) ; if ( obj . has ( "media" ) ) { tweet . image = obj . getJSONArray ( "media" ) . getJSONObject ( 0 ) . getString ( "media_url_https" ) ; } else { tweet . image = "" ; } return tweet ; }
basically converts JSON data to Tweet
basically converts JSON data to Tweet
//what does static do? //extract the values from JSON //gets JSON object associated with the string