change Unit using TypedValue - Android android.util

Android examples for android.util:TypedValue

Description

change Unit using TypedValue

Demo Code


//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*/
}

Related Tutorials