0

I am developing social media app in which I already coded the logic to take image from my phone gallery but when I retrieve gif image from gallery it doesn't show me any animation of that gif image, it just shows the still image and I have post feature also but there also it doesn't show me animation of gif image, so if anyone know how to get the gif image working on android app then please help me.

The logic to retrieve image from gallery is:

this is a onClick function when i click on camera icon it take me back to gallery.

Photo.launch("image/*");

before this i created the global variable for photo and then i stored the image in the firebase database using registerForActivityResult

I want to know how to get the gif image animation working after I retrieve them from gallery.

ram shinde
  • 21
  • 3
  • Use Glide as your image loader, as [Glide supports GIF](https://stackoverflow.com/q/31082330/115145). Or, use [a dedicated GIF library](https://android-arsenal.com/tag/193?sort=created). – CommonsWare Nov 18 '22 at 16:38
  • Load gif using `coil` https://coil-kt.github.io/coil/gifs/ – Ammar Abdullah Nov 19 '22 at 05:02
  • @Ammar Abdullah where should i add that code for image loader in my project in which file ? – ram shinde Dec 30 '22 at 11:28
  • @ramshinde check it out . It for loading images using `Glide` https://stackoverflow.com/a/72543476/15218726 – Ammar Abdullah Dec 30 '22 at 12:52
  • Just replace `.load(IMAGE_URL)` with `.load(R.drawable.your_gif)` – Ammar Abdullah Dec 30 '22 at 12:54
  • @Ammar Abdullah, Thank you Ammar but I am trying to fetch gifs from my emulators gallery just like the normal images and when I fetch any gif image from gallery it does not show me any animation just frozen image of that gif so if you can help me with that then that would be amazing. – ram shinde Dec 31 '22 at 08:15
  • pass that gif uri from `onActivityResult` to `.load(uri)` then Glide will play gif for you – Ammar Abdullah Dec 31 '22 at 08:17

0 Answers0