Reputation: 1237
I have to capture multiple images from camera, convert it into .gif file and show it to the view below is the code that converts the ArrayList to byte[].
public byte[] generateGIF(ArrayList<Bitmap> bitmaps) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
AnimatedGifEncoder encoder = new AnimatedGifEncoder();
encoder.start(bos);
for (Bitmap bitmap : bitmaps) {
encoder.addFrame(bitmap);
}
encoder.finish();
return bos.toByteArray();
}
Now in which I could show it and how
Upvotes: 1
Views: 809
Reputation: 11
You can show Animated GIF using Glide
.
Glide.with(GIFViewActivity.this)
.load(byteList.get(0))
.asGif()
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.into(imageViewGIF);
Upvotes: 1