Question

I am using UIL for loading and displaying images in a ListFragment wich works great. In the ListView I am using the Handler-Pattern. No problem so far.

But if I click on a ListEntry to display another image within a second fragment it fails.

The weird thing is if I click on a button in the second fragment do load that image, it works like a charme.

The log-output shows in both cases that the image is in the disc-cache, that it was scaled aso. - no errors.

This function is part of the Fragment: (and is always called from Thread 1 (UI))

    public void updateStockInfo(final String symbol) {

    if (viewer != null) {
        //final ImageView imageview = (ImageView) viewer.findViewById(R.id.stockinfo);

        urlForStockInfo = "http://chart.finance.yahoo.com/c/3m/d/" + symbol.toLowerCase();

        imageloader.loadImage(getActivity(), urlForStockInfo, new ImageLoadingListener() {
            ...

            @Override
            public void onLoadingComplete(final Bitmap loadedImage) {
                imageview.setImageBitmap(loadedImage);
                logger.debug("Loadinf complete");
            }
        });
    }

Calling updateStockInfo from onActivityCreated (its the same with onCreateView) fails without an exception or so. The thread for loading the image does not start. In LoadAndDisplayImageTas:run() there is a check for Thread.interrupted() on line 89 - this check fails.

Buuuuuttt if manually (press button) call updateStockInfo if works???

In all cases updateStockInfo is called by the UI-Thread.

Any hints? thx in advance!

[Update]
I downloaded the source and removed the check for Thread.interupted() on line 92

        if (/* Thread.interrupted() || */checkTaskIsNotActual()) return;
    if (configuration.loggingEnabled) Log.i(ImageLoader.TAG, String.format(LOG_DISPLAY_IMAGE_IN_IMAGEVIEW, imageLoadingInfo.memoryCacheKey));

You know what - it works. Was this a bug or does it just work for my special case?

Was it helpful?

Solution

More likely you call ImageLoader.stop() somewhere in activity.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top