get Screen Density - Android Phone

Android examples for Phone:Screen

Description

get Screen Density

Demo Code


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

public class Main {
    public static float getScreenDensity(Context context) {
        DisplayMetrics metrics = context.getApplicationContext()
                .getResources().getDisplayMetrics();
        return metrics.density;
    }//from  w w w .j  a  v a 2  s.com
}

Related Tutorials