print Device Info - Android Hardware

Android examples for Hardware:Device Feature

Description

print Device Info

Demo Code


//package com.java2s;

import android.content.Context;

import android.util.DisplayMetrics;

public class Main {
    public static void printDeviceInfo(Context context) {
        DisplayMetrics metric = context.getResources().getDisplayMetrics();
        float density = metric.density;
        float densityDpi = metric.densityDpi;
        int heightPixels = metric.heightPixels;
        float scaledDensity = metric.scaledDensity;
        float xdpi = metric.xdpi;
        float ydpi = metric.ydpi;
        //      Logger.d("DeviceUtil", "density " + density + ",densityDpi " + densityDpi + ", densityDpi " + densityDpi + ", heightPixels " + heightPixels
        //            + ", scaledDensity " + scaledDensity + ", xdpi " + xdpi + ", ydpi " + ydpi);
    }/*from   w ww.jav a 2  s.  c  om*/
}

Related Tutorials