title: Application's PagerAdapter changed the adapter's contents without calling notifyDataSetChanged()
body: <p>I am developing a simple game on android. I have an activity to fetch data from server and load it into ViewPager. This is the activity code snippet:</p>
  
  <pre><code>    url = new ArrayList&lt;&gt;();
      name = new ArrayList&lt;&gt;();
      viewPager = (ViewPager) findViewById(R.id.viewPager);
      viewPagerAdapter = new ViewPagerAdapter(getApplicationContext(),url,name);
      viewPager.setAdapter(viewPagerAdapter);
  
      AppController.socket.emit("getDoodle","")
              .on("doodleList", new Emitter.Listener() {
                  @Override
                  public void call(Object... args) {
                      JSONArray data = (JSONArray)args[0];
                      Log.e("MYTAG",data.toString());
                      url.clear();
                      name.clear();
                      for(int i=0;i&lt;AppController.playersId.size();i++){
                          try {
                              if(!data.getJSONObject(i).getString("doodle").equals("null")) {
                                  url.add(data.getJSONObject(i).getString("doodle"));
                                  name.add(data.getJSONObject(i).getString("id"));
                              }
                          } catch (JSONException e) {
                              e.printStackTrace();
                          }
                      }
  
  
                      runOnUiThread(new Runnable() {
                          @Override
                          public void run() {
                              viewPagerAdapter.notifyDataSetChanged;
                          }
                      });
                  }
              });
  </code></pre>
  
  <p>This is my PagerAdapter:</p>
  
  <pre><code>    class ViewPagerAdapter extends PagerAdapter {
  
  Context mContext;
  ArrayList&lt;String&gt; mUri,mId;
  
  public ViewPagerAdapter(Context context, ArrayList&lt;String&gt; imageUri, ArrayList&lt;String&gt; sid){
      mContext = context;
      mUri = imageUri;
      this.mId=sid;
      Log.e("MYTAG",mUri.toString());
  }
  @Override
  public int getCount() {
      return mUri.size();
  }
  
  @Override
  public int getItemPosition(Object object) {
      return POSITION_NONE;
  }
  
  @Override
  public Object instantiateItem(ViewGroup container, final int position) {
      LayoutInflater mLayoutInflater=(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      View itemView = mLayoutInflater.inflate(R.layout.pager_child, container, false);
  
      final ImageView imageView = (ImageView) itemView.findViewById(R.id.doodleView);
      TextView nameText = (TextView) itemView.findViewById(R.id.ownerText);
      String temp = mUri.get(position);
      if(!temp.equals("")){
          Log.e("replace","2");
          Glide.with(mContext)
                  .load(temp)
                  .diskCacheStrategy(DiskCacheStrategy.NONE)
                  .into(imageView);
          nameText.setText(mId.get(position));
      }
      Log.d("pager",mUri.get(position));
      itemView.setTag(position);
      container.addView(itemView);
      return itemView;
  }
  
  @Override
  public void destroyItem(ViewGroup container, int position, Object object) {
      container.removeView((LinearLayout) object);
  }
  
  @Override
  public boolean isViewFromObject(View view, Object object) {
      return false;
  }}
  </code></pre>
  
  <p>My error Log:</p>
  
  <pre><code>FATAL EXCEPTION: main
                                                              Process: com.nirup.fuku, PID: 10421
                                                              java.lang.IllegalStateException: The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 0, found: 1 Pager id: com.nirup.fuku:id/viewPager Pager class: class android.support.v4.view.ViewPager Problematic adapter: class com.nirup.fuku.ViewPagerAdapter
                                                                  at android.support.v4.view.ViewPager.populate(ViewPager.java:1167)
                                                                  at android.support.v4.view.ViewPager.populate(ViewPager.java:1116)
                                                                  at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1642)
                                                                  at android.view.View.measure(View.java:19857)
                                                                  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
                                                                  at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
                                                                  at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
                                                                  at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
                                                                  at android.view.View.measure(View.java:19857)
                                                                  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
                                                                  at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
                                                                  at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
                                                                  at android.view.View.measure(View.java:19857)
                                                                  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
                                                                  at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
                                                                  at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
                                                                  at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
                                                                  at android.view.View.measure(View.java:19857)
                                                                  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
                                                                  at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
                                                                  at android.view.View.measure(View.java:19857)
                                                                  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
                                                                  at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
                                                                  at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
                                                                  at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
                                                                  at android.view.View.measure(View.java:19857)
                                                                  at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6083)
                                                                  at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
                                                                  at com.android.internal.policy.DecorView.onMeasure(DecorView.java:689)
                                                                  at android.view.View.measure(View.java:19857)
                                                                  at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2275)
                                                                  at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1366)
                                                                  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1619)
                                                                  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254)
                                                                  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6337)
                                                                  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874)
                                                                  at android.view.Choreographer.doCallbacks(Choreographer.java:686)
                                                                  at android.view.Choreographer.doFrame(Choreographer.java:621)
                                                                  at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860)
                                                                  at android.os.Handler.handleCallback(Handler.java:751)
                                                                  at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                  at android.os.Looper.loop(Looper.java:154)
                                                                  at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                  at java.lang.reflect.Method.invoke(Native Method)
                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
  </code></pre>
  
  <p>I don't know what I'm doing wrong.. Any help appreciated.</p>