How to get screen resolution information?

I need to get screen resolution, width and height, how to do it?

Decision:

    Display d = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();


    width = d.getWidth();
    height = d.getHeight();
+3
source share
2 answers
Display d=Display.getInstance();
int width = d.getDisplayWidth();
int height = d.getDisplayHeight();

According to http://forums.java.net/jive/message.jspa?messageID=479230

or maybe

Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
int width = display.getWidth(); 

http://www.coderanch.com/t/435390/Android/Mobile/screen-size-at-run-time

+5
source

, , . , . ( ..), , , , .. , , , , , .

- , , onSizeChanged().

+4

Source: https://habr.com/ru/post/1763130/


All Articles