AnimatedImageDrawable with remote url

130 views Asked by At

I'm trying to use AnimatedImageDrawable for displaying animated images in my app, but I keep hitting an error each time I run the app:

Java.IO.FileNotFoundException: No content provider: https://media.tenor.com/images/9bb45d1ce61bdf2f367b9e8f9b78b70f/tenor.gif

This is the code I'm using:

var cr = Application.Context.ContentResolver;
var uri = Uri.Parse(imageUrl); // using Uri = Android.Net.Uri;
var src = ImageDecoder.CreateSource(cr, uri);
var drawable = ImageDecoder.DecodeDrawable(src); // throws exception here...

imageView.SetImageDrawable(drawable);

if (drawable is AnimatedImageDrawable animatedImageDrawable)
{
    animatedImageDrawable.Start();
}

it throws an exception on ImageDecoder.DecodeDrawable. My main question is, does this API work with remote images and if so what am I doing wrong?

0

There are 0 answers