How can I get screen width Android in java?

285    Asked by JamesWILLIAMS in Java , Asked on Oct 6, 2022

 How to detect the screen size for different android phones?

I want the coordinate values like startx, starty, endx, endy. With that I can use the swipe method which takes these coordinates as parameters.

I used

Dimension size = driver.manage().window().getSize();


Answered by James Wilson

You can get screen width Android and screen height using the below code:


  Dimension dimensions = driver.manage().window().getSize();

  int screenWidth = dimensions.getWidth();

  int screenHeight = dimensions.getHeight();



Your Answer

Interviews

Parent Categories