Android examples for App:Resource
Get value from Resource
//package com.java2s; import android.content.Context; import android.util.TypedValue; public class Main { private static TypedValue mTmpValue = new TypedValue(); public static int getResourceValue(Context context, int resId) { TypedValue value = mTmpValue;// w ww .j a va 2 s . com context.getResources().getValue(resId, value, true); return (int) TypedValue.complexToFloat(value.data); } }