Obtain uri of a raw file by name
int idFile= getResources().getIdentifier("fileName", "raw", MyClass.class.getPackage().getName());
Uri uri = Uri.parse("android.resource://com.myapppackeage/" + idFile);
Written by José Manuel Pereira (JMPergar)
Related protips
1 Response
Ojo, ese código sólo funcionará si MyClass está en el mismo package que el que tiene la app en el AndroidManifest.xml...
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Android
Authors
Related Tags
#android
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#