Issue
I am trying to get a video from "android.resource://" + getPackageName() + "/raw/video", and it reads it perfectly. How can I check if that file exists or is missing?
Solution
You can check like this .
int checkExistence = mContext.getResources().getIdentifier("FILENAME_WITHOUT_EXTENSION", "raw", mContext.getPackageName());
if ( checkExistence != 0 ) { // the resouce exists...
result = true;
}
else { // checkExistence == 0 // the resouce does NOT exist!!
result = false;
}
Answered By - Sardar Khan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.