Reputation: 2402
Hi i have an arrayList of urls that i want to pass into a customArrayAdapter that displays the images in a list. I also want this to be performed asynchronously. so far i have tried creating a drawable from the URL inside the CustomArrayAdapter and putting that function within an ASyncTask but i'm struggling to get it working is this the best method of doing this or does anyone know of a better way?
heres what i have tried so far
ImageView contactImage = (ImageView) v.findViewById(R.id.docicon);
if(imageURLs != null){
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.init(ImageLoaderConfiguration.createDefault(getContext()));
imageLoader.displayImage(image, contactImage);
}else{
contactImage.setBackgroundResource(R.drawable.sc_user);
}
Upvotes: 0
Views: 31
Reputation: 2737
For asynchronously loading images into ImageViews
from a network resource, I highly recommend using one of the following libraries:
For example, loading an ImageView
from a network resource using UniversalImageLoader is as simple as...
imageLoader.displayImage(imageUri, imageView);
Upvotes: 2