Android gets the height and width of the screen

Android gets the height and width of the screen and uses the WindowManager class

There are two methods

1、WindowManager wm = (WindowManager) getContext()
                    .getSystemService(Context.WINDOW_SERVICE);

     int width = wm.getDefaultDisplay().getWidth();
     int height = wm.getDefaultDisplay().getHeight();

2、WindowManager wm = this.getWindowManager();

     int width = wm.getDefaultDisplay().getWidth();
     int height = wm.getDefaultDisplay().getHeight();

Read More: