Can multi-touch events be tested on the Android Emulator? Or is there any way to test this without an actual device? I am using the 2.0 sdk and want to test zoom-in/zoom-out with two fingers.
Multi-touch is available since Android 2.0 and has been improved in the version 2.2. This description uses the API as of version 2.2. The MotionEvent. ACTION_POINTER_DOWN and MotionEvent.
Run your app on the emulatorIn the toolbar, select the AVD that you want to run your app on from the target device drop-down menu. Click Run. The emulator might take a minute or so to launch for the first time, but subsequent launches will use a snapshot and should launch faster.
There is no official API in iOS or Android to detect an emulator. Therefore, several proprietary checks have to be done by the RASP system.
I finally discovered how to do a pinch-zoom on the Android emulator for Android Studio 3.2. This was hard to find, but hope it helps someone.
That was easy - or not.
UPDATE:
Yes, now there is (not for the 2.x Android, but the latest ones).
In case people still searching with this function, if you are using default emulator from android studio, for mac user you can hold command button, and for windows/linux i believe it is alt button while left clicking with your mouse – HendraWD
And for Linux, it's Ctrl + left click (however, I don't know if it's the same on Windows, so HendraWD may be right about that one)
Plus another thing you can do (with Android 4.0+) is pipe touch events through one device into the emulator. This is helpful if you only have one device, but would like to test those same touch events on other versions/dimensions of Android. (See http://tools.android.com/tips/hardware-emulation)
In any case, these are just workarounds, if multitouch is important for your app, I would still recommend that you go to an Android Developer user group with your laptop and ask for help to test your app on the spot. Your fellow developers can be super helpful with this.
In my groups, we share phones all the time (especially since most of us don't own all the different Android handsets out there). And if you don't have an Android user group in your area, assuming you live in a large enough metropolitan area, consider possibly starting such a group yourself. You're most likely not the only one who will need help with this stuff.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With