Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;
import android.util.TypedValue;

public class Main {
    /**
     * Converts a value from device independent pixels (dp) to pixels.
     * @param context context.
     * @param dpValue the value to convert.
     * @return the given value converted to pixels.
     */
    public static float toPixels(Context context, float dpValue) {
        return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpValue,
                context.getResources().getDisplayMetrics());
    }
}