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 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 :: setting up javafx in eclipse vm argument 
Java :: console log java 
Java :: for with two values java 
Java :: How do you nuke japan 
Java :: how to get witdth of window android 
Java :: full screen in jframe 
Java :: junit 5 dependency maven 
Java :: java pause 
Java :: java get mouse position on screen 
Java :: main code of java 
Java :: how to circular a bitmap android 
Java :: javafx tableview remove all rows 
Java :: bukkit inventory set name 
Java :: transparent dialog in android 
Java :: print list in java 
Java :: is grepper legit 
Java :: kill all java processes windows 
Java :: format localdatetime 
Java :: spring load config value in variable 
Java :: java import random 
Java :: javafx open file dialog 
Java :: javafx file to image 
Java :: android plain text remove underline 
Java :: new hashmap java 
Java :: java get random index from array 
Java :: display default value of auto commit java 
Java :: spring execute code after variable injected 
Java :: turn off focus border java 
Java :: java console write 
Java :: binary string to int java 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =