Ad

How To Add Multiple GIFs To Android GridView

- 1 answer

How to add multiple GIFs to Android GridView? Let's assume that we have a 4*4 grid (16 cells), with a different individual animated GIF image being shown in each cell in such a way that each image is animating on its own. Therefore creating a GIF of 16 different videos/animations, all playing at the same time in 16 separate cells.

Ad

Answer

First Step

In you GridAdapter make a function

public void upadteList(List<yourGifList> list){
         this.gifList = list;
         notifyDataSetChanged();
     }

then in OnBind Method call
Glide.with(context).asGif().load(gifList).into(imageView);

Second

In your activity call upadteList() method
gridAdapter.updateList(imagesList);

Note : i am assuming you are already have a recyclerView setup.

Ad
source: stackoverflow.com
Ad