0

I have a ListView with OnItemClickListener set, each row contains an ImageView. For some rows i set bitmap in this ImageView using https://github.com/nostra13/Android-Universal-Image-Loader. For these rows (and only for these rows) when i click on ImageView, nothing happens. Everything but ImageView correctly calls onItemClick(AdapterView<?> adapterView, View view, int position, long itemId). I want to know how to fix these behaviour. Any ideas?

Here is some code from my ListAdapter:

private static final ImageLoader mImageLoader = ImageLoader.getInstance();
private static final DisplayImageOptions mImageLoaderOptions =
    new DisplayImageOptions.Builder().showStubImage(R.drawable.stub_image).cacheInMemory()
        .imageScaleType(ImageScaleType.EXACTLY_STRETCHED).build();

@Override
public View getView(int position, View convertView, ViewGroup parent) {
  Item item = mItemList.get(position);
   ListItemViewHolder holder;

  if (convertView == null) {
    convertView = inflater.inflate(R.layout.list_item, null);
    holder =
        new ListItemViewHolder(mContext, convertView);
    convertView.setTag(holder);
  } else {
    holder = (ListItemViewHolder) convertView.getTag();
  }

  image = (ImageView) convertView.findViewById(R.id.receipt_icon);
  mImageLoader.displayImage(someImagePath, image,
          mImageLoaderOptions);
  return convertView;
}
Seblis
  • 339
  • 4
  • 17
  • Is the ImageView set to be clickable somehow? – HannahMitt Aug 13 '13 at 12:08
  • what is this `new ListItemViewHolder(mContext, convertView)`? – Raghunandan Aug 13 '13 at 12:18
  • I modified my code a bit before posting here and i forgot these lines are unnecesarry. `ListItemViewHolder` is a standard holder pattern like here: http://www.vogella.com/articles/AndroidListView/article.html#adapterperformance_hoder – Seblis Aug 14 '13 at 06:55

1 Answers1

1

Add

android:clickable="true"

to the XML for your imageView

Broak
  • 4,161
  • 4
  • 31
  • 54