How to drag in Robotium?

In this article we are going to see how to Drag an Item in robotium. Android provides seperate event for dragging.

We need to initiate the Solo object. After initiation, we will uses solo to get those.

-To drag( Simulate touching) from a specified location to a new location.
solo.drag(0, 240, 0, 400, 10);

In here , parameters
a. From position (X coordinate) of initial touch
b. To position (X coordinate) of the drag destination
c. From position (Y coordinate) of initial touch
d. To position (Y coordinate) of the drag destination 
e. Step counter(integer) indicating the number of steps to drag. Step count is the number performing the drag operation in to number of steps. Ex- it we move (0,0) to (240,400) , we can make it in 10 steps or 240 steps. If we make 10 steps, dragging will be (0,0) to (

Thanks..:) 

2 comments:

  1. Hi
    Different phones has different screen size.Will it work on every screen in same way?

    ReplyDelete