Get path of Android resource

Use URI Paths instead of “absolute” path, see this post

Uri path = Uri.parse("android.resource://com.segf4ult.test/" + R.drawable.icon);
Uri otherPath = Uri.parse("android.resource://com.segf4ult.test/drawable/icon");

Or use openRawResource(R.id) to open an inputStream, and use it the same way you would use a FileInputStream (readonly)

Leave a Comment