Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;

import android.util.TypedValue;

public class Main {
    /**
     * dp2Px
     *
     * @param context context
     * @param dp      dp
     * @return float
     */
    public static float dp2Px(Context context, int dp) {
        return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp,
                context.getResources().getDisplayMetrics());
    }
}