I have the below code to get the video(glass.avi) from res->raw folder in Android studio and save to sd card. But it is showing file not found exception.
vuri= Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.glass);
OutputStream out;
try
{
ByteArrayOutputStream stream = new ByteArrayOutputStream();
FileInputStream fis = new FileInputStream(new File(String.valueOf(vuri)));
byte[] buf = new byte[1024];
int n;
while (-1 != (n = fis.read(buf)))
stream.write(buf, 0, n);
byte[] bytes = stream.toByteArray();
String root = Environment.getExternalStorageDirectory().getAbsolutePath()+"/";
File createDir = new File(root+"master"+File.separator);
createDir.mkdir();
File file = new File(root + "master" + File.separator +"master.avi");
file.createNewFile();
out = new FileOutputStream(file);
out.write(bytes);
out.close();
} catch (IOException e) {
e.printStackTrace();
}