Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test physical mouse on Android Emulator

Android 8 adds support for pointer capture. https://developer.android.com/training/gestures/movement.html#pointer-capture

Is there any way how can I test it in android emulator? By default mouse emulates touch events, even I call requestPointerCapture with successful result.

like image 993
user1063364 Avatar asked Jan 19 '26 03:01

user1063364


1 Answers

The Desktop AVDs (Android Virtual Devices) have mouse support.

The host mouse cursor is forwarded to the emulator. In my personal testing, hover events were fired in apps running on this AVD. They did not fire on phone or tablet AVDs.

Also testable with Desktop AVDs:

  • Keyboard shortcuts
  • Scrolling via Mouse scrollwheel

More information:

  • Desktop AVDs: https://android-developers.googleblog.com/2023/11/bringing-new-input-support-to-desktop-avd.html.
  • How to set up AVDs with Android Studio: https://developer.android.com/studio/run/managing-avds

These AVDs are available since late 2023 (see blogpost above).

like image 134
aruh Avatar answered Jan 21 '26 21:01

aruh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!