Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I suspect that your <code>imageDownloader</code> is calling <code>setImageResource</code> (or equivalent--it's setting the <code>src</code> attribute) of your <code>ImageView</code>, while you are initially calling <code>setBackgroundResource</code>. That would explain the overlap.</p> <p>What you need to do is change <code>setBackgroundResource</code> to <code>setImageResource</code> in the following code:</p> <pre><code> if(data.getTemplateIconId()!=0 &amp;&amp; data.getTemplateIconUrl()==null ){ Log.d("Load icon ","Default Load"); // This line should say setImageResource: holder.templateIcon.setBackgroundResource(data.getTemplateIconId()); } else ... </code></pre> <p>The issue that @Akos mentions (which he appears to have deleted) will be an issue for you if a download takes a long time and the view has already been reused. To restate what he stated, once you get this working via the solution above, you will find that if an image download takes a long time (so long that the row has already been reused, and the new image set) that your images may be overwritten with older images.</p> <p>Therefore, inside of <code>imageDownloader</code> you will also want to say, before downloading:</p> <pre><code>imageView.setTag(url); </code></pre> <p>and then after the download completes, before setting the image in the <code>ImageView</code>:</p> <pre><code>if(!(String)imageView.getTag().equals(url) { return; } </code></pre> <p>This way, if the <code>ImageView</code> has been reused by another row in the meantime, the download will simply abort.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload