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.Context;

import android.support.annotation.NonNull;

public class Main {
    /**
     * Gets the resource id from the name and type
     * ex... getResIdFromIdentifier(ctx, "error_msg", "string");
     * @param context
     * @param name
     * @param defType
     * @return resourceId
     */
    public static int getResIdFromIdentifier(@NonNull Context context, String name, String defType) {
        return context.getResources().getIdentifier(name, defType, context.getPackageName());
    }
}