get Value From Resource Id - Android App

Android examples for App:Resource

Description

get Value From Resource Id

Demo Code


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

public class Main {
    public static int getValueFromResourceId(final Context context,
            int resourceId) {
        final TypedValue value = new TypedValue();
        context.getTheme().resolveAttribute(resourceId, value, true);
        return value.data;
    }/*from   w  w  w . j  a v a2 s  .co  m*/
}

Related Tutorials