Search code examples
androiduniversal-image-loader

Cancel loading image with universal-image-loader


I have GridView with remote image in every block. When I scroll it as fast as possible it lags the first time. After that it has loaded every image and works smoothly. How can I cancel loading image for blocks that went off screen ?


Solution

  • If You are Using ViewHolder Pattern, UIL Handles it by itself and you Don't need to Cancel Loading Images for blocks that went off screen!

    see this Part of Source Code

    else if (isViewWasReused()) {
            L.d(LOG_TASK_CANCELLED_IMAGEAWARE_REUSED, memoryCacheKey);
            listener.onLoadingCancelled(imageUri, imageAware.getWrappedView());
        }
    

    read more about ViewHolder Pattern