Skip to content Skip to sidebar Skip to footer

Android-Universal-Image-Loader Doesn't Keep Loaded Images On Scroll In Gridview

I am using Android-Universal-Image-Loader library to load a remote pictures to ImageView in my GridView cells. Here the the imageLoader configurations: new ImageLoaderConfiguration

Solution 1:

I have encountered the same problem on Universal-Image-Loader Demo and I hope the Library developers will solve the problem in the next update.

UPDATE: The problem fixed with help of nostra13, you have to update the library to 1.9 version and use this way of displaying pictures in the imageView:

ImageAware imageAware = new ImageViewAware(imageView, false);
imageLoader.displayImage(imageUri, imageAware);

It solved my problem. Some details of why you should do this can be found here and here


Solution 2:

you must use the Adapter and then implement the ViewHolder to make the Flow of scrolling smooth and effective. provide tag to images w.r.t to their positions provided in getView() and then there will be no problem.


Solution 3:

Do not use set tag in adapter getView() method.always try to find view ids in your adapter getview() method.

public View getView(final int position, View convertView, ViewGroup parent) {

View view = convertView;
ViewHolder holder;


    view = Config.context.getLayoutInflater().inflate(R.layout.featured, null);
    holder = new ViewHolder();

    holder.titleText = (TextView) view.findViewById(R.id.featured_title);
    holder.priceText = (TextView) view.findViewById(R.id.featured_price);
    holder.image = (ImageView) view.findViewById(R.id.thumbnail_image);

    view.setTag(holder);



HashMap<String, String> listing = listings.get(position);

/* set text values */
holder.titleText.setText(listing.get("title"));
holder.priceText.setText(listing.get("price"));

/* load image to list (AsyncTask) */
Utils.imageLoaderFeatured.displayImage(listing.get("photo"), holder.image, Utils.imageLoaderOptionsFeatured);

return view;}

Solution 4:

You should declare the ImageLoader and DisplayImageOptions instance only once. Probably in constructor.

ImageLoader imageLoader = ImageLoader.getInstance();
DisplayImageOptions options = new DisplayImageOptions.Builder().cacheInMemory(true)
        .cacheOnDisc(true).resetViewBeforeLoading(true)
        .showImageForEmptyUri(fallbackImage)
        .showImageOnFail(fallbackImage)
        .showImageOnLoading(fallbackImage).build();

Solution 5:

Same problem here, using a StaggeredGridView. Even with memory cache and the ImageAware method, it isn't solved.

The only thing that worked for me was expanding the cache memory from 4 to 10 MB. List images are small, but I have a very large image as header of the view.

I noticed that imageViews are refreshed also on a long click, is this valid even for GridView?

Anyway, expanding the memory cache limit fixed this too.


Post a Comment for "Android-Universal-Image-Loader Doesn't Keep Loaded Images On Scroll In Gridview"