---
title: "motionEventSpy"
description: "Calls [watcher] with each [MotionEvent] that the layout area or any child [pointerInput]
receives. The [MotionEvent] may or may not have been transformed to the local coordinate system.
The Compose View will be considered as handling the [MotionEvent] in the area that the
[motionEventSpy] is active.

This method can only be used to observe [MotionEvent]s and can not be used to capture an event
stream.

[watcher] is called during the [PointerEventPass.Initial] pass.

Developers should use [pointerInput] to handle pointer input processing within Compose.
[motionEventSpy] is only useful as part of Android View interoperability.

If you need to handle and consume [MotionEvent]s, use [pointerInteropFilter]."
type: "modifier"
---

<div class='type'>Compose Modifier</div>

<a id='references'></a>
<div class='sourceset sourceset-android'>Android</div>


```kotlin
fun Modifier.motionEventSpy(watcher: (motionEvent: MotionEvent) -> Unit): Modifier
```


Calls `watcher` with each `MotionEvent` that the layout area or any child `pointerInput`
receives. The `MotionEvent` may or may not have been transformed to the local coordinate system.
The Compose View will be considered as handling the `MotionEvent` in the area that the
`motionEventSpy` is active.

This method can only be used to observe `MotionEvent`s and can not be used to capture an event
stream.

`watcher` is called during the `PointerEventPass.Initial` pass.

Developers should use `pointerInput` to handle pointer input processing within Compose.
`motionEventSpy` is only useful as part of Android View interoperability.

If you need to handle and consume `MotionEvent`s, use `pointerInteropFilter`.



