0

I am working on a project where I have a requirement to play a gif in an Android widget ImageView. For this purpose I have tried all the possible ways by using Glide and libraries like
https://github.com/felipecsl/GifImageView
https://github.com/koral--/android-gif-drawable

Problems I am facing

  1. Glide - I couldn't load gif into an ImageView because of a RemoteView property (i.e only bitmaps and resources can be assigned, Not drawables)

  2. Libraries - I couldn't use any third party libraries because all libraries extends View (Since RemoteView doesn't support View in the layout), CustomView cannot be also implemented because there is no ways to assign or call custom methods (Since setImageViewResource and setImageViewBitmap are only possible methods revealed in RemoteView)

What I am trying to do:

Since I couldn't find any solution for this requirement, so I am trying to do my own methodology by downloading and breaking gif into multiple frames as Bitmap and then planning to use those frames in the RemoteView. Kindly help me if any other solutions can be implemented to achieve this feature. I have been working on this since for the past 7 days, but couldn't find any solutions for my requirement. Any sort of tips and suggestion would be very helpful for me. Thanks in advance.

frogmanx
  • 2,620
  • 1
  • 18
  • 20
Chandru
  • 5,954
  • 11
  • 45
  • 85

1 Answers1

-1

Yes, you can use ImageViews to load gif, with this:

ImageView imageView = (ImageView) findViewById(R.id.imageView);
GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(imageView);
Glide.with(this).load(YOUR_GIF).into(imageViewTarget);
Chisko
  • 3,092
  • 6
  • 27
  • 45