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 type, String name) {
        try {
            int resID = context.getResources().getIdentifier(name, type, context.getPackageName());
            return resID;
        } catch (Exception e) {
            new StringBuilder("uiType: ").append(type).append(" idName: ").append(name).toString();
            e.printStackTrace();
        }
        return 0;
    }
}