title: Chris Banes PullToRefreshListView with Custom Adapter Error
body: <p>I'm Settings up a Custom ListView.</p>
  
  <p>The pull-to-refresh feature comes straight from <a href="https://github.com/chrisbanes/Android-PullToRefresh" rel="nofollow">https://github.com/chrisbanes/Android-PullToRefresh</a></p>
  
  <p>The ListView displayes Images, so i created a custom Adapter:</p>
  
  <pre><code>class mAdapter extends BaseAdapter{
  
      public mAdapter(Context context){
          // nothing to do
      }
  
      @Override
      public int getCount() {
          return mValues.size();
      }
  
      @Override
      public Object getItem(int position) {
          return mValues.get(position);
      }
  
      @Override
      public long getItemId(int position) {
          return position;
      }
  
      @Override
      public boolean areAllItemsEnabled() 
      { 
              return false; 
      }
  
      @Override
      public boolean isEnabled(int position) 
      { 
              return false; 
      } 
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          View v = convertView;
          if(v == null){
              LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              v = inflater.inflate(R.layout.list_item, null);
          }
          ImageView iv = (ImageView) v.findViewById(R.id.imageView);
          if(iv != null){
              displayImageInView(iv);
              iv.setClickable(true);
              iv.setOnClickListener(new View.OnClickListener() {          
                  @Override
                  public void onClick(View v) {
                      Toast.makeText(context, "ImageView", Toast.LENGTH_SHORT).show();
                  }
              });
          }
          return v;
      }
  }
  </code></pre>
  
  <p>in onCreate(), i get the listView and assign the adapter:</p>
  
  <pre><code>mListView = (PullToRefreshListView) findViewById(R.id.listView);
  mListView.setAdapter(new mAdapter(context));
  </code></pre>
  
  <p>After that i add an image to mValues (url for image to load from web) and call notifiyDataSetChanged on the adapter.</p>
  
  <p>in mListView.onRefresh(), i add an image to mValues.</p>
  
  <p>This works smoothly for adding the first image, or even the first bunch of images (before calling mAdapter.notifyDataSetChanged()).
  The refresh indicator shows and hides as intended.</p>
  
  <p>The weird things start happening when i try to add another image (or bunch) after that.</p>
  
  <p>The refresh indicator shows, the image is displayed in the list view.</p>
  
  <p>BUT : the refresh indicator never hides again after that. "onRefreshComplete()" gets called, but seems not to work properly the second time.</p>
  
  <p>The UI Thread is not blocking, so operation is still possible.
  If i delete all items in mValues, notify the adapter and pull to refresh again, the image is added properly, and the refresh indicator is hidden properly.</p>
  
  <p>Conclusion: The pull-to-refresh only hides properly if the list was empty before refreshing.</p>
  
  <p>I really don't know where to look for a solution for this weird error.</p>
  
  <p>Maybe someone familiar with the Pull-To-Refresh Library from Chirs Banes can help me out here.</p>
  
  <p>Thank You !</p>