title: Android save MediaStore image with mime type GIF
body: <p>While this code successfully creates an image that is also present in the phone's gallery, the extension is '.jpg' instead of '.gif'.</p>
  
  <pre class="lang-java prettyprint-override"><code>    File gifFile; // gif file stored in Context.getFilesDir()
  
      final ContentValues contentValues = new ContentValues();
      contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, "Image" + System.currentTimeMillis());
      contentValues.put(MediaStore.MediaColumns.MIME_TYPE, "image/gif");
  
      // Create a new gif image using MediaStore
      final Uri gifContentUri = context.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);
      // Open a writable stream pointing to the new file created by MediaStore
      OutputStream outputStream = context.getContentResolver().openOutputStream(gifContentUri, "w");
      // Copy the original file from the app private data folder to the file created by MediaStore
      IOUtils.copyFile(new FileInputStream(gifFile), outputStream);
  </code></pre>
  
  <p>Output file is created inside Pictures folder by MediaStore. If I manually change the output file's extension to gif, the gif animation is playing inside Android gallery.</p>
  
  <p>I feel I'm missing a small detail for this to work</p>