You can save the gif with this code
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(); }
This code will save the gif in the cache directory on your external SD card, but will not be displayed in the Gallery.
source share