Java tutorial
//package com.java2s; //License from project: Apache License import android.content.ContentResolver; import android.content.Context; import android.content.res.Resources; import android.net.Uri; public class Main { public static Uri getURIFromResrouceID(Context context, int resId) { Resources resources = context.getResources(); Uri u = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + resources.getResourcePackageName(resId) + '/' + resources.getResourceTypeName(resId) + '/' + resources.getResourceEntryName(resId)); return u; } }