title: Save image from ImageView to device gallery
body: <p>I'm trying to save an image from ImageView to devices gallery.
  I tried this code</p>
  
  <p>Code Edit:</p>
  
  <pre><code>    URL url = new URL(getIntent().getStringExtra("imageURL"));
      File f  = new File(url.getPath());
  
      addImageToGallery(f.getPath(), this);
  
      public static void addImageToGallery(final String filePath, final Context context) 
      {
  
         ContentValues values = new ContentValues();
  
         values.put(MediaStore.Images.Media.DATE_TAKEN, System.currentTimeMillis());
         values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
         values.put(MediaStore.MediaColumns.DATA, filePath);
  
         context.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
      }
  </code></pre>
  
  <p>but it requires a file path in which I don't have since I'm loading the file from a URL.
  How can I save an image from ImageView to the gallery?</p>
  
  <p>thanks..</p>