Skip to content

Instantly share code, notes, and snippets.

@dominicthomas
Created February 24, 2015 09:38
Show Gist options
  • Save dominicthomas/a18d5d01f0b586fe41e6 to your computer and use it in GitHub Desktop.
Save dominicthomas/a18d5d01f0b586fe41e6 to your computer and use it in GitHub Desktop.
Get a uri to an android resource..
public static Uri resourceToUri(final Context context, final int resID) {
return Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" +
context.getResources().getResourcePackageName(resID) + '/' +
context.getResources().getResourceTypeName(resID) + '/' +
context.getResources().getResourceEntryName(resID));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment