Sunday, July 17, 2022

[FIXED] How to get gif image from a link in android-gif-drawable? [Android]

Issue

I'm using this library to display my gif files. When my gif files are saved in my device storage it displays the gif file okay, by using

GifDrawable gifFromPath;
File gifFile;


GifImageView gifImageView = (GifImageView) findViewById(R.id.imageHome);

gifFile = new File(context.getFilesDir().getAbsolutePath(), imageName);
try {
                gifFromPath = new GifDrawable(gifFile);
            } catch (IOException e) {
                e.printStackTrace();
            }
gifImageView.setImageDrawable(gifFromPath);

I'm wondering how can I display the gif file if instead of using the path where it is saved I want to get the gif from a link / url.


Solution

I use this library. And I use ImageView instead.

ImageView myImageView = (ImageView) findViewById(R.id.myImageView);

Glide.with(this).load(url).into(myImageView);


Answered By - natsumiyu
Answer Checked By - Mary Flores (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.