Here you can find the source of getResDimen(Context context, int resId)
public static int getResDimen(Context context, int resId)
//package com.java2s; import android.content.Context; import android.util.SparseArray; public class Main { private static SparseArray<Integer> sDimenMap = new SparseArray<Integer>(); public static int getResDimen(Context context, int resId) { if (sDimenMap.indexOfKey(resId) > 0) { return sDimenMap.get(resId); } else {//from www . ja v a 2 s .co m int dimen = (int) context.getResources().getDimension(resId); sDimenMap.put(resId, dimen); return dimen; } } }