app/src/main/java/com/codepath/apps/restclienttemplate/TimelineActivity.java
// Get all the tweets from the client GET into an array and let the adapter know the data set has updated
Get all the tweets from the client GET into an array and let the adapter know the data set has updated
Get all the tweets from the client GET into an array and let the adapter know the data set has updated
private void populateHomeTimeline() {
        client.getHomeTimeline(new JsonHttpResponseHandler() {
            @Override
            public void onSuccess(int statusCode, Headers headers, JSON json) {
                JSONArray jsonArray = json.jsonArray;
                try {
                    tweets.addAll(Tweet.fromJsonArray(jsonArray));
                    adapter.notifyDataSetChanged();
                    Log.i(TAG, "Populated timeline");
                } catch (JSONException e) {
                    Log.e(TAG, "Error populating timeline: " + e.toString());
                }
            }
            @Override
            public void onFailure(int statusCode, Headers headers, String response, Throwable throwable) {
                Log.e(TAG, response.toString());
                Log.e(TAG, "onFailure to populate timeline: " + throwable.toString());
            }
        });
    }
private void populateHomeTimeline ( ) { client . getHomeTimeline ( new JsonHttpResponseHandler ( ) { @ Override public void onSuccess ( int statusCode , Headers headers , JSON json ) { JSONArray jsonArray = json . jsonArray ; try { tweets . addAll ( Tweet . fromJsonArray ( jsonArray ) ) ; adapter . notifyDataSetChanged ( ) ; Log . i ( TAG , "Populated timeline" ) ; } catch ( JSONException e ) { Log . e ( TAG , "Error populating timeline: " + e . toString ( ) ) ; } } @ Override public void onFailure ( int statusCode , Headers headers , String response , Throwable throwable ) { Log . e ( TAG , response . toString ( ) ) ; Log . e ( TAG , "onFailure to populate timeline: " + throwable . toString ( ) ) ; } } ) ; }
Get all the tweets from the client GET into an array and let the adapter know the data set has updated
Get all the tweets from the client GET into an array and let the adapter know the data set has updated