Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.ContentResolver;
import android.content.Context;

import android.net.Uri;

public class Main {
    /**
     * Get URI string from resourceId.
     *
     * @param context The context.
     * @param resourceId The resource id.
     * @return The URI string.
     */
    public static String getUriString(final Context context, final int resourceId) {
        if (context == null) {
            throw new IllegalArgumentException("context == null");
        }
        return new Uri.Builder().scheme(ContentResolver.SCHEME_ANDROID_RESOURCE).authority(context.getPackageName())
                .appendPath(Integer.toString(resourceId)).toString();
    }
}