Code example for Display

Methods: getHeightgetOrientationgetPixelFormatgetRefreshRategetWidth

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);