Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    public static int getResourceId(Context context, String key, String type) throws RuntimeException {
        int resource = context.getResources().getIdentifier(key, type, context.getPackageName());

        if (resource == 0) {
            throw new RuntimeException("Missing resource " + key);
        }

        return resource;
    }
}