app/src/main/java/com/codepath/apps/restclienttemplate/TimelineActivity.java
@Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
            // get data from intent
            Tweet tweet = Parcels.unwrap(data.getParcelableExtra("tweet"));

            // update recycler view with new tweet
            // modify data source to include tweet
            tweets.add(0, tweet);
            // update adaptor
            adaptor.notifyItemInserted(0);
            rvTweets.smoothScrollToPosition(0);
        }
        super.onActivityResult(requestCode, resultCode, data);
    }
// Override when you need to pass things back to parent activity
Override when you need to pass things back to parent activity
Override when you need to pass things back to parent activity
@Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
            Tweet tweet = Parcels.unwrap(data.getParcelableExtra("tweet"));
            tweets.add(0, tweet);
            adaptor.notifyItemInserted(0);
            rvTweets.smoothScrollToPosition(0);
        }
        super.onActivityResult(requestCode, resultCode, data);
    }
@ Override protected void onActivityResult ( int requestCode , int resultCode , @ Nullable Intent data ) { if ( requestCode == REQUEST_CODE && resultCode == RESULT_OK ) { Tweet tweet = Parcels . unwrap ( data . getParcelableExtra ( "tweet" ) ) ; tweets . add ( 0 , tweet ) ; adaptor . notifyItemInserted ( 0 ) ; rvTweets . smoothScrollToPosition ( 0 ) ; } super . onActivityResult ( requestCode , resultCode , data ) ; }
Override when you need to pass things back to parent activity
Override when you need to pass things back to parent activity
// get data from intent // update recycler view with new tweet // modify data source to include tweet // update adaptor