Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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;
    }
}