Get the Size of display in android

To get the current screen's width and height, just using DisplayMetrics and WindowManager

DisplayMetrics displayMetrics = new DisplayMetrics();
WindowManager wm = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
int screenWidth = displayMetrics.widthPixels;
int screenHeight = displayMetrics.heightPixels;


Popular posts from this blog

Clear the app data programmatically in android

convert an integer to a string in java

Print the large string values in android log cat.