Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

android get screen width and height

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

how to get android windows width

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

how to get width android

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

PREVIOUS NEXT
Code Example
Java :: remove spaces at beginning and end of string java 
Java :: java random word from list 
Java :: how to get a section of an array in java 
Java :: RecyclerView: No layout manager attached; skipping layout 
Java :: jframe actionlistener 
Java :: circular textview android 
Java :: java get year from date 
Java :: java datetime now 
Java :: convert string to character array 
Java :: enum to int java 
Java :: onclick listener android 
Java :: java indexof array 
Java :: how to find the sum of an array in java 
Java :: android java xml combo box 
Java :: Java Stack class pop() method 
Java :: string replace java 
Java :: How to create a popup window (PopupWindow) in Android 
Java :: localdate java 
Java :: Create a button that redirects to another activity in android studio 
Java :: is upper in java 
Java :: java camel case 
Java :: arraylist of arraylist 
Java :: generate random password in spring boot 
Java :: check GPS is on android 
Java :: create new empty list java 
Java :: How to find the next greater permutation of a list of numbers, in Java? 
Java :: JAVA Display Sum of n Natural Numbers 
Java :: measure running time of a statement java 
Java :: code for checking android build version 
Java :: android application manifest 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =