使用
https://github.com/koush/ion图像加载程序将gif文件显示到ImageView中
我通过此代码将jpg图像保存到图库中
MediaStore.Images.Media.insertImage( getActivity().getContentResolver(),bitmap,"XXX","Image1");
但这种方式不适用于gif文件.
你知道我怎么能做到这一点?
解决方法
你可以使用这段代码保存gif
File file = new File(getBaseContext().getExternalCacheDir(),"gif_name"+ ".gif"); try { FileOutputStream fos = new FileOutputStream(file); fos.write(gif.getData());//gif is gif image object fos.flush(); fos.close(); } catch (IOException ioe) { ioe.printStackTrace(); }
此代码将gif保存在外部SD卡的缓存目录中,但在Gallery中不可见.