M vasu
M vasu

Reputation: 21

How to use clickLongOnScreen(x, y) in Robotium?

I am new to Robotium .For the method clickLongOnScreen(x, y), I know x and y are the coordinates. But how can I get coordinates value ? Please help me.

Upvotes: 2

Views: 1274

Answers (2)

Rudolf Coutinho
Rudolf Coutinho

Reputation: 225

If u have the view id, you con use the following to write test case that work on all screen sizes.

int[] location = new int[2];
View view = solo.getView(id);
view.getLocationOnScreen(location);
int x= location[0];
int y= location[1];

Upvotes: 0

Uriel Frankel
Uriel Frankel

Reputation: 14622

  1. Go to your device (or emulator) Settings screen -> Developer options -> Show Pointer location.
  2. Check it's checkbox.
  3. look on the top of the screen and there you'll see the X and Y coordinates

Upvotes: 3

Related Questions