title: Recyclerview adapter initialised with empty array and subsequently populated with values
body: <p>I'm creating a recyclerview adapter in my onCreate method with an empty list. It is necessary to do so as tagging onto the mAdapter is a scroll listener which allows me to obtain another page from the database server if I scroll up (I have not copied and pasted that code for brevity sake).</p>
  
  <pre><code>public class MainActivity extends ActionBarActivity {
  
  ArrayList&lt;Post&gt; totalPost = new ArrayList&lt;&gt;();
  
   @Override
   protected void onCreate(Bundle savedInstanceState) {
          mAdapter = new MyAdapter(totalPost, mRecyclerView);
          mRecyclerView.setAdapter(mAdapter); }
  </code></pre>
  
  <p>I'm calling my network operation in onResume and onResume happens subsequent to onCreate.</p>
  
  <p>Once I get a success from my network operation, I'm doing this however nothing happens:</p>
  
  <pre><code> totalPost = Lists.newArrayList(result.getPosts()); //saving the network results into an array
   mAdapter.notifyDataSetChanged();
  </code></pre>
  
  <p>I have also tried this:</p>
  
  <pre><code>totalPost = Lists.newArrayList(result.getPosts()); //saving the network results into an array
  mAdapter.notifyItemRangeChanged(0, totalPost.size());
  </code></pre>
  
  <p>I have also tried this and it works but it is not ideal. I create a new adapter here and I also lose my scroll listener. I can also not reference my scroll listener in my method that references my network operations as that would be 'circular reference':</p>
  
  <pre><code>totalPost = Lists.newArrayList(result.getPosts()); //saving the network results into an array
  mAdapter = new MyAdapter(totalPost, mRecyclerView);
  mRecyclerView.setAdapter(mAdapter);
  </code></pre>
  
  <p>Why is the adapter not working?</p>