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 getDrawableUri(Context context, int resId) { Resources resources = context.getResources(); return Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + resources.getResourcePackageName(resId) + '/' + resources.getResourceTypeName(resId) + '/' + resources.getResourceEntryName(resId)); } }