PackageCom.kale.screen;ImportAndroid.annotation.SuppressLint;Importandroid.app.Activity;ImportAndroid.graphics.Point;ImportAndroid.os.Bundle;ImportAndroid.util.Log;ImportAndroid.view.Display; Public classMainactivityextendsActivity {@SuppressLint ("Newapi") @Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); Setcontentview (R.layout.activity_main); intDW = Getwindowmanager (). Getdefaultdisplay (). GetWidth ();//get the width of your phone screen intDH = Getwindowmanager (). Getdefaultdisplay (). GetHeight ();//get the height of your phone screenLOG.I ("H", "Height:" +DW); LOG.I ("W", "width:" +DH); //The recommended way to get the screen to be long and wide, but requires API13Display display =Getwindowmanager (). Getdefaultdisplay (); Point size=NewPoint (); Display.getsize (size); intWindowHeight =size.y; intWindowWidth =size.x; LOG.I ("W", "width:" +windowwidth); LOG.I ("H", "Height:" +windowheight); }}