How to get screen size (width,height) in Android?

With the Display object we can get the Screen width and height

Display display = getWindowManager().getDefaultDisplay(); 
int width = display.getWidth();
int height = display.getHeight();

 

But getWidth(),getHeight() are deprecated from Android API Level 13 and introduced getSize() method

Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;

 


Flutter Questions
Android Questions