List of usage examples for android.util TypedValue complexToFloat
public static float complexToFloat(int complex)
From source file:Main.java
public static int getActionBarHeightInDp(Context context) { int actionBarHeight = 0; TypedValue tv = new TypedValue(); final DisplayMetrics dm = context.getResources().getDisplayMetrics(); if (Build.VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) { if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) actionBarHeight = (int) TypedValue.complexToFloat(tv.data); } else {//from ww w . j a v a2s . c o m tv.data = 48; actionBarHeight = (int) TypedValue.complexToFloat(tv.data); } return actionBarHeight; }
From source file:Main.java
public static int getResourceValue(Context context, int resId) { TypedValue value = mTmpValue;//from w w w. ja va2 s . c o m context.getResources().getValue(resId, value, true); return (int) TypedValue.complexToFloat(value.data); }