How can I get the URI of image saved in drawable. I have tried following formats, but everytime it cannot load the image.
imageURI= Uri.parse(\"android.resou
You can also try this:
Bitmap bm = BitmapFactory.decodeResource( getResources(), R.drawable.myimage_name);
String extStorageDirectory = Environment.getExternalStorageDirectory().toString();
File file = new File(extStorageDirectory, "MyIMG.png");
FileOutputStream outStream = null;
try {
outStream = new FileOutputStream(file);
bm.compress(Bitmap.CompressFormat.PNG, 100, outStream);
outStream.flush();
outStream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Uri imguri=Uri.fromFile(file);