title: Why `PagerAdapter::notifyDataSetChanged` is not updating the View?
body: <p>I'm using the ViewPager from the compatibility library. I have succussfully got it displaying several views which I can page through.</p>
  
  <p>However, I'm having a hard time figuring out how to update the ViewPager with a new set of Views.</p>
  
  <p>I've tried all sorts of things like calling <code>mAdapter.notifyDataSetChanged()</code>, <code>mViewPager.invalidate()</code> even creating a brand new adapter each time I want to use a new List of data.</p>
  
  <p>Nothing has helped, the textviews remain unchanged from the original data.</p>
  
  <p><strong>Update:</strong> 
  I made a little test project and I've almost been able to update the views. I'll paste the class below.</p>
  
  <p>What doesn't appear to update however is the 2nd view, the 'B' remains, it should display 'Y' after pressing the update button.</p>
  
  <pre><code>public class ViewPagerBugActivity extends Activity {
  
      private ViewPager myViewPager;
      private List&lt;String&gt; data;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          data = new ArrayList&lt;String&gt;();
          data.add("A");
          data.add("B");
          data.add("C");
  
          myViewPager = (ViewPager) findViewById(R.id.my_view_pager);
          myViewPager.setAdapter(new MyViewPagerAdapter(this, data));
  
          Button updateButton = (Button) findViewById(R.id.update_button);
          updateButton.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  updateViewPager();
              }
          });
      }
  
      private void updateViewPager() {
          data.clear();
          data.add("X");
          data.add("Y");
          data.add("Z");
          myViewPager.getAdapter().notifyDataSetChanged();
      }
  
      private class MyViewPagerAdapter extends PagerAdapter {
  
          private List&lt;String&gt; data;
          private Context ctx;
  
          public MyViewPagerAdapter(Context ctx, List&lt;String&gt; data) {
              this.ctx = ctx;
              this.data = data;
          }
  
          @Override
          public int getCount() {
              return data.size();
          }
  
          @Override
          public Object instantiateItem(View collection, int position) {
              TextView view = new TextView(ctx);
              view.setText(data.get(position));
              ((ViewPager)collection).addView(view);
              return view;
          }
  
          @Override
          public void destroyItem(View collection, int position, Object view) {
               ((ViewPager) collection).removeView((View) view);
          }
  
          @Override
          public boolean isViewFromObject(View view, Object object) {
              return view == object;
          }
  
          @Override
          public Parcelable saveState() {
              return null;
          }
  
          @Override
          public void restoreState(Parcelable arg0, ClassLoader arg1) {
          }
  
          @Override
          public void startUpdate(View arg0) {
          }
  
          @Override
          public void finishUpdate(View arg0) {
          }
      }
  }
  </code></pre>