Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.util.DisplayMetrics;

public class Main {
    static int dpToPx(float dp, float ppi, DisplayMetrics displayMetrics) {
        dp /= displayMetrics.density;
        int px = Math.round(dp * (ppi / DisplayMetrics.DENSITY_DEFAULT));
        return px;
    }
}