Reading
Add Comment
Getting screen size in dimensions in android
With the help of following code we can get the screen size in dimensions in android -
- In the case of when we are in Activity
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
- In the case of when we are not in Activity
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay();
0 comments:
Post a Comment