Android Get Screen Width And Height

[Solved] Android Get Screen Width And Height | Swift - Code Explorer | yomemimo.com
Question : android get screen width and height

Answered by : panos-karamolegkos

DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
float dpHeight = displayMetrics.heightPixels / displayMetrics.density;
float dpWidth = displayMetrics.widthPixels / displayMetrics.density;
Log.d("MyHeight", dpHeight+"");
Log.d("MyWidth", dpWidth+"");

Source : | Last Update : Mon, 07 Jun 21

Question : get screen size android

Answered by : ill-ibis-63u76bmkb3ph

DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int height = displayMetrics.heightPixels;
int width = displayMetrics.widthPixels;

Source : https://stackoverflow.com/questions/4743116/get-screen-width-and-height-in-android | Last Update : Mon, 05 Oct 20

Question : how to get width android

Answered by : tired-tamarin-0hs03y9tuyhs

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

Source : https://stackoverflow.com/questions/1016896/how-to-get-screen-dimensions-as-pixels-in-android | Last Update : Fri, 18 Dec 20

Answers related to android get screen width and height

Code Explorer Popular Question For Swift