title: Android Volley - Show progress bar in listview adapter when loading image
body: <p>I tried to get image from network with <code>Volley</code> in listview item. While downloading image, the progress bar is showing, when complete, it should be hide.</p>
  
  <p>Here is my adapter:</p>
  
  <pre><code>   public class NewsAdapter  extends CursorAdapter{
  public NewsAdapter(Context context, Cursor c) {
      super(context, c, true);
  }
  
  @Override
  public Cursor getItem(int position) {
      return (Cursor) super.getItem(position);
  }
  
  @Override
  public void bindView(View view, final Context context, Cursor cursor) {
      final NetworkImageView imgNewsItem = (NetworkImageView) view.findViewById(R.id.imgNewsItem); 
      final ProgressBar progressNewsList = (ProgressBar) view.findViewById(R.id.progressNewsList);
  
      progressNewsList.setVisibility(View.VISIBLE);
      imgNewsItem.setVisibility(View.GONE);
      Ln.d("get news image: %s", cursor.getString(cursor.getColumnIndex(News.IMAGE_COLUMN)));
      ImageCacheManager.getInstance().getImageLoader().get(cursor.getString(cursor.getColumnIndex(News.IMAGE_COLUMN)), new ImageListener() {
  
          @Override
          public void onErrorResponse(VolleyError error) {
              Ln.e(error);
              progressNewsList.setVisibility(View.GONE);
              imgNewsItem.setVisibility(View.VISIBLE);
              imgNewsItem.setImageResource(R.drawable.news_default_image);
          }
  
          @Override
          public void onResponse(ImageContainer response, boolean isImmediate) {
              progressNewsList.setVisibility(View.GONE);
              imgNewsItem.setVisibility(View.VISIBLE);
              imgNewsItem.setImageBitmap(response.getBitmap());
          }
      });
  }
  
  @Override
  public View newView(Context arg0, Cursor arg1, ViewGroup parent) {
      LayoutInflater inflater = LayoutInflater.from(parent.getContext());
      View retView = inflater.inflate(R.layout.row_view, parent, false);
      return retView;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I have debugged and found that Volley download and cache image bitmap is ok, but the image view doesn't display.</p>
  
  <p>My item layout look like this:</p>
  
  <pre><code> &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_margin="5dp" &gt;
  
      &lt;com.android.volley.toolbox.NetworkImageView
          android:id="@+id/imgNewsItem"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:adjustViewBounds="true"
          android:scaleType="fitXY"
          android:src="@drawable/news_default_image"
        android:visibility="gone" /&gt;
  
      &lt;ProgressBar
          android:id="@+id/progressNewsList"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center" 
          &gt;
      &lt;/ProgressBar&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>The ImageCacheManager from this example: <a href="https://github.com/rdrobinson3/VolleyImageCacheExample" rel="nofollow">https://github.com/rdrobinson3/VolleyImageCacheExample</a>
  Could you please tell me where I am wrong?. Thanks in advance.</p>
  
  <p><strong>Update</strong>: another, the progress bar isn't showed when downloading.</p>