public Uri getUriForResource(String resourcePath, int resourceType) {
        // Get from app resources
        Resources resources = context.getResources();
        int resourceId = getResourceId(resources, resourcePath, resourceType);

        // Get from system resources
        if (resourceId == 0) {
            resources = Resources.getSystem();
            resourceId = getResourceId(resources, resourcePath, resourceType);
        }

        if (resourceId == 0) {
            Log.w(TAG, "Resource not found: " + resourcePath);
            return Uri.EMPTY;
        }

        // Will be something like:
        // App Resource: android.resource://com.example.app/raw/mySound
        return new Uri.Builder()
            // Scheme: android.resource
            .scheme(ContentResolver.SCHEME_ANDROID_RESOURCE)
            // Authority: com.example.app (for the App)
            .authority(resources.getResourcePackageName(resourceId))
            // Resource directory: raw
            .appendPath(resources.getResourceTypeName(resourceId))
            // Resource name: mySound
            .appendPath(resources.getResourceEntryName(resourceId))
            .build();
    }
Gets the Uri for a resource in the res directory.
@param resourcePath Path like res://mySound, res://myImage.png, etc.
@param resourceType Can be {@link AssetUtil#RESOURCE_TYPE_DRAWABLE} or {@link AssetUtil#RESOURCE_TYPE_RAW}
@return {@link Uri.EMPTY} if a resource could not be found.
src/android/util/AssetUtil.java