'Saving an AnimationDrawable object to a file
I am very new to android development and trying to make an application that will convert a video to GIf using MediaMetadataRetriever and AnimationDrawable. I am able to display the GIF but I am not able to save the file. I want to know how I can save this GIF as a file or essentially an AnimationDrawable object to a file in JAVA.
Thanks
MediaMetadataRetriever mmRetriever = new MediaMetadataRetriever();
mmRetriever.setDataSource(MainActivity.this,result);
AnimationDrawable animatedGIF = new AnimationDrawable();
Bitmap bitmap = mmRetriever.getFrameAtTime(n); #n is any integer
Drawable d = (Drawable) new BitmapDrawable(getResources(), bitmap);
animatedGIF.addFrame(d,200);
binding.imageView.setImageDrawable(animatedGIF);
animatedGIF.setOneShot(false);
animatedGIF.start();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|