Code example for Display

Methods: getSize

		Display display = wm.getDefaultDisplay();
		if (Build.VERSION.SDK_INT<=16){ // Android 4.0 and lowers
			if (Build.VERSION.SDK_INT>13){
				Point size = new Point();
				results.put("Screen width", String.valueOf(size.x));
				results.put("Screen height", String.valueOf(size.y));
			} else { 
				try { 
					Method mGetRawH = Display.class.getMethod("getRawHeight");
					Method mGetRawW = Display.class.getMethod("getRawWidth");
					results.put("Screen width",String.valueOf((Integer) mGetRawW.invoke(display)));
					results.put("Screen height", String.valueOf((Integer) mGetRawH.invoke(display)));
				} catch (Exception e) {
					Log.d("Error", "\n Error accessing to video data.");
					results.put("Screen width", "UNKNOWN");
					results.put("Screen height", "UNKNOWN");
Contextual code suggestions in your IDE  Get Codota for Java