Code example for Display

Methods: getHeightgetMetricsgetOrientationgetPixelFormatgetRefreshRategetWidth

0
        DebugUtils2.d("", "displayCheck() Start"); 
        String retInfo = "";
        //ディスプレイ情報 
        WindowManager wm = (WindowManager) act.getSystemService(Context.WINDOW_SERVICE);
        Display display = wm.getDefaultDisplay();
        Log.i(className, "width="+ String.valueOf(display.getWidth()));
        retInfo = retInfo.concat("width="+ String.valueOf(display.getWidth()) + BR);  
        Log.i(className, "height="+ String.valueOf(display.getHeight()));
        retInfo = retInfo.concat("height="+ String.valueOf(display.getHeight()) + BR);  
        Log.i(className, "orientation="+ String.valueOf(display.getOrientation()));
        retInfo = retInfo.concat("orientation="+ String.valueOf(display.getOrientation()) + BR);  
        Log.i(className, "refreshRate="+ String.valueOf(display.getRefreshRate()));
        retInfo = retInfo.concat("refreshRate="+ String.valueOf(display.getRefreshRate()) + BR);  
        Log.i(className, "pixelFormat="+ String.valueOf(display.getPixelFormat()));
        retInfo = retInfo.concat("pixelFormat="+ String.valueOf(display.getPixelFormat()) + BR);  
        retInfo = retInfo.concat(BR);  
 
        DisplayMetrics metrics = new DisplayMetrics(); 
        display.getMetrics(metrics);  
        Log.i(className, "density=" + metrics.density);
        retInfo = retInfo.concat("density=" + metrics.density + BR);  
        Log.i(className, "densityDpi=" + metrics.densityDpi);
        retInfo = retInfo.concat("densityDpi=" + metrics.densityDpi + BR);  //ver4
        Log.i(className, "scaledDensity=" + metrics.scaledDensity);
Stop searching for code, let great code find you!  Add Codota to your java IDE