public int getDimensionPixelOffset(int index, int defValue) { if (mRecycled) { throw new Exception("Cannot make calls to a recycled instance!"); } index *= AssetManager.STYLE_NUM_ENTRIES; int[] data = mData; int type = data[index + AssetManager.STYLE_TYPE]; if (type == TypedValue.TYPE_NULL) { return(defValue); } else if (type == TypedValue.TYPE_DIMENSION) { return(TypedValue.complexToDimensionPixelOffset(data[index + AssetManager.STYLE_DATA], mMetrics)); } else if (type == TypedValue.TYPE_ATTRIBUTE) { throw new Exception("Failed to resolve attribute at index " + index); } throw new Exception("Can't convert to dimension: type=0x" + type.ToString("X")); }