dragWithHold

fun UiDevice.dragWithHold(fromX: Int, fromY: Int, toX: Int, toY: Int, durationMillis: Long = 500, holdMillis: Long = 600, uiAutomation: UiAutomation = InstrumentationRegistry.getInstrumentation().uiAutomation): Boolean(source)

Performs a real drag: presses at the origin, holds for holdMillis, moves to the destination over durationMillis, settles, and releases.

UiDevice.drag and swipe start moving immediately, which reads as a fling; a hold is what puts reorderable lists and drag-and-drop targets into their drag state.

Return

true when every event was injected.

Parameters

fromX

The start x coordinate, in screen pixels.

fromY

The start y coordinate, in screen pixels.

toX

The end x coordinate, in screen pixels.

toY

The end y coordinate, in screen pixels.

durationMillis

The time spent moving.

holdMillis

The time held at the origin before moving.

uiAutomation

The automation connection that injects events.