i'm trying to get the URI of a file in the raw folder of my app in this way:
Uri myUri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.myfile);
or
Uri myUri = Uri.parse("android.resource://mypackage/raw/myfile");
Then i use this method to check if the uri was correct:
File f = new File(myUri.toString());
if (f.exists()) {
Log.d("YES", "file exist");
}
if (!f.exists()){
Log.d("NO", "file doesn't exist");
}
But i always get: "No, file doesn't exist".
Do you know why?