Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.res.TypedArray; public class Main { @SuppressWarnings("ConstantConditions") public static float resolveFloat(Context context, int attr) { TypedArray a = context.obtainStyledAttributes(null, new int[] { attr }); try { return a.getFloat(0, 0); } finally { a.recycle(); } } }