Using MediaStore.Images.Media to save bitmap in particular folder

onexf picture onexf · Apr 7, 2016 · Viewed 15k times · Source

I have to save bitmap drawn on canvas to be saved in my own folder.

String imgSaved = MediaStore.Images.Media.insertImage(
                    getContentResolver(), drawView.getDrawingCache(),
                    UUID.randomUUID().toString() + ".png", "drawing"); 

How should i give a path to the directory? e.g. "/sdcard/MyPictures/"

Answer

Rakesh picture Rakesh · Apr 7, 2016

Try creating File object for your desired path

File mFile = new File("/sdcard/tmp");

String imgSaved=MediaStore.Images.Media.insertImage(getContentResolver(),mFile.getAbsolutePath(),UUID.randomUUID().toString()+".png", "drawing"); 

Check out this link for reference.