resolve Resource - Android App

Android examples for App:Resource

Description

resolve Resource

Demo Code


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

public class Main {
    public static int resolveResource(Context context, int attr) {
        int[] attribute = new int[] { attr };
        TypedArray array = context.obtainStyledAttributes(attribute);
        int reference = array.getResourceId(0, 0);
        array.recycle();/*  w ww .ja va2 s . c  om*/
        return reference;
    }
}

Related Tutorials