Vins
Vins

Reputation: 4119

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.

Upvotes: 6

Views: 5502

Answers (1)

jeet
jeet

Reputation: 29199

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.

Upvotes: 10

Related Questions