Code example for TypedArray

Methods: getDimensionPixelSize, recycle

0
mMaxHeight = 0x7fffffff;
        TypedArray typedarray = context.obtainStyledAttributes(attributeset, new int[] {
            0x1010120 
        }); 
        mMaxHeight = typedarray.getDimensionPixelSize(0, 0);
        typedarray.recycle();
    } 
 
    protected final void onMeasure(int i, int j)
    { 
        if(mMaxHeight > 0)
        { 
            if(android.view.View.MeasureSpec.getMode(i) == 0x80000000)
                i = android.view.View.MeasureSpec.makeMeasureSpec(android.view.View.MeasureSpec.getSize(i), 0x40000000);
            if(android.view.View.MeasureSpec.getMode(j) == 0x80000000)
                j = android.view.View.MeasureSpec.makeMeasureSpec(Math.min(android.view.View.MeasureSpec.getSize(j), mMaxHeight), 0x40000000);
        } else 
        { 
            i = android.view.View.MeasureSpec.makeMeasureSpec(android.view.View.MeasureSpec.getSize(i), 0x40000000);
            j = android.view.View.MeasureSpec.makeMeasureSpec(android.view.View.MeasureSpec.getSize(j), 0x40000000);