Code example for TypedArray

Methods: getFraction, peekValue

0
    public static boolean isValidDimensionPixelOffset(final int dimension) {
        return dimension >= 0;
    } 
 
    public static float getFraction(final TypedArray a, final int index, final float defValue) {
        final TypedValue value = a.peekValue(index);
        if (value == null || !isFractionValue(value)) {
            return defValue;
        } 
        return a.getFraction(index, 1, 1, defValue);
    } 
 
    public static float getFraction(final TypedArray a, final int index) {
        return getFraction(a, index, UNDEFINED_RATIO);
    } 
 
    public static int getDimensionPixelSize(final TypedArray a, final int index) {
        final TypedValue value = a.peekValue(index);
        if (value == null || !isDimensionValue(value)) {
            return ResourceUtils.UNDEFINED_DIMENSION;
        }