Back to project page ImageScanner.
The source code is released under:
Apache License
If you think the Android project ImageScanner listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.scanner.utils; //from w w w .j a v a 2 s. c o m import android.content.Context; import android.graphics.Point; import android.os.Build; import android.view.Display; import android.view.WindowManager; public class DensityUtil { public static int SCREENWIDTH; public static int SCREENHEIGHT; /** * * * @param context * @return */ public static int getScreenWidth(Context context) { int width = 0; WindowManager window = (WindowManager) context .getSystemService(Context.WINDOW_SERVICE); Display display = window.getDefaultDisplay(); if(Build.VERSION.SDK_INT > 12){ Point point = new Point(); display.getSize(point); width = point.x; }else{ width = display.getWidth(); } SCREENWIDTH = width; return width; } /** * ????????? * * @param context * @return */ public static int getScreenHeight(Context context) { int height = 0; WindowManager window = (WindowManager) context .getSystemService(Context.WINDOW_SERVICE); Display display = window.getDefaultDisplay(); if(Build.VERSION.SDK_INT > 12){ Point point = new Point(); display.getSize(point); height = point.y; }else{ height = display.getHeight(); } SCREENHEIGHT = height; return height; } }