Get Screen Size Android

[Solved] Get Screen Size Android | 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 : how to get witdth of window android

Answered by : elated-elephant-muafsdv5f697

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

Source : | Last Update : Sun, 14 Jun 20

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

Answers related to get screen size android

Code Explorer Popular Question For Swift