Any time you have something that happens randomly, and you have any kind of a thread, you should think two works, Race Condition. Basically, your AsyncTasks are all loading the same image. They should be passed in the value to load. I noticed you aren't doing anything with params. I'm not sure exactly what you should do, but the problem is somewhere in your AsyncTask.
@Override
protected Bitmap doInBackground(Object... params) {
Bitmap bitmap = null;
try {
bitmap = BitmapFactory.decodeStream((InputStream)new URL(items.get("thumburl")).getContent());
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return bitmap;
}
You should probably pass in the URL (Or the string it represents). In this example, I pass in the URL, but feel free to change it around how you want. The key thing is, you should pass a representation of the image location into the function, rather than try to figure out what image to use when you are in the function.
new setLogoImage(new Url(items.get("thumburl"))).execute(); // Async Method call
@Override
protected Bitmap doInBackground(Url... input) {
Bitmap bitmap = null;
try {
bitmap = BitmapFactory.decodeStream((InputStream)input[0]).getContent());
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return bitmap;
}