Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get max X and Max Y points in android?

Im using

RectF(float left, float top, float right, float bottom)

to create a rectangle. For some the max x value and max y value going out of Screen. But the same values lies inside the screen for some big screens. So is there anyway to check what is the max value for the current Screen so that i can use the cordinates within the screen.

like image 509
Vins Avatar asked Feb 11 '12 05:02

Vins


1 Answers

you can fetch width and height of screen, by following:

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

here width and height are max points in x and y direction.

like image 199
jeet Avatar answered Oct 15 '22 19:10

jeet