get Res Id By Name from resource - Android App

Android examples for App:Resource

Description

get Res Id By Name from resource

Demo Code


//package com.java2s;

import android.content.Context;

public class Main {

    public static int getResIdByName(Context context, String name) {
        return context.getResources().getIdentifier(name, "id",
                context.getPackageName());
    }/*w ww .ja  v  a 2 s .  c  om*/
}

Related Tutorials