get resource Attr ID - Android App

Android examples for App:Resource

Description

get resource Attr ID

Demo Code


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

public class Main {
    public static int getAttrID(Context context, String key) {
        return context.getResources().getIdentifier(key, "attr",
                context.getPackageName());
    }//from   ww w  .  j a v  a  2 s  .c o  m
}

Related Tutorials