[mono-android] Can't get ImageLoader class to update my image when loaded from URI

rcastles rcastles at pmg.net
Mon Jun 25 00:31:02 UTC 2012


I am attempting to implement a new "BadgeElement" class within the MonoDroid
Dialog project, which is going well.

I'm also trying to implement the lazy loading code for the "ImageLoader"
class, within this new BadgeElement.

Within my BadgeElement, I've implemented an IImageUpdated class with
"ImageLoaderCallback". My callback is called seemingly immediately when my
ImageView loads, but when I perform RequestImage again in the callback, the
Drawable is not found, and it returns null.

My new "BadgeElement.cs" is here http://pastebin.com/JYA10pvM

This actually works except for getting the updated image for newly cached
URIs. The images show when I scroll through the list after forcing them to
reload/update. Also, if I close my app and restart, the images load from
cache. The only thing I can't get going is to have the images update when
they are first loaded. In line 136, this method gets a null back for
"RequestImage". Any ideas?

The callback class itself is here:

    private class ImageLoaderCallback : IImageUpdated
    {
        int i = 0;

        public ImageLoaderCallback (Context context, ImageView iv, Uri
imageUri)
        {
            int i = 0;
            Drawable newDrawable;
            newDrawable = badgeIL.RequestImage ((Uri)imageUri, null);

            if (newDrawable != null) {
                iv.SetImageDrawable (newDrawable);
            }
        }

        public void UpdatedImage (System.Uri uri)
        {
            int i = 0;
        }
    }

--
View this message in context: http://mono-for-android.1047100.n5.nabble.com/Can-t-get-ImageLoader-class-to-update-my-image-when-loaded-from-URI-tp5710499.html
Sent from the Mono for Android mailing list archive at Nabble.com.


More information about the Monodroid mailing list