Android examples for android.util:TypedValue
change Unit using TypedValue
//package com.java2s; import android.content.Context; import android.util.TypedValue; public class Main { public static int changeUnit(Context context, int unit, float value) { return (int) TypedValue.applyDimension(unit, value, context .getResources().getDisplayMetrics()); }/*from w w w . j a v a2 s .c o m*/ }