I am using Fresco to download and display Gifs in my app. I want to save the image to sdcard when click it, but i can't figure out how to do it.
final View view = inflater.inflate(R.layout.fragment_gif_viewer, container, false);
SimpleDraweeView draweeView = (SimpleDraweeView) view.findViewById(R.id.image);
Uri uri = Uri.parse(imageUrl);
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setUri(uri)
.setAutoPlayAnimations(true)
.build();
draweeView.setController(controller);
draweeView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Save the gif to /sdcard/test.gif
}
});
I try to get the bitmap from the SimpleDraweeView following the instruction of How do I save an ImageView as an image?, but it's getDrawingCache() returns null
You can use the image pipeline directly to extract your GIF from disk cache.
Then you can use Java File methods to write it to the file system.