Abhijit
Abhijit

Reputation: 105

How to get mouseover event from android emulator

How to get x and y coordinates of mouse over.

I have a service in android and which is connected to .net application via eneter messaging framework. I wants x and y position of mouse from service. I want mouse positions not only on clicks but also on mouse over.

Many thanks

Upvotes: 1

Views: 3389

Answers (2)

Lev Leontev
Lev Leontev

Reputation: 2615

You can also use Android x86 in Live CD mode (or install it in dual-boot with Windows).

Upvotes: 0

vovkab
vovkab

Reputation: 1292

Maybe not a best solution but atleast it works. Both solutions are based on Genymotion emulator.

Solution #1

  1. You need to install Genymotion emulator.
  2. Run emulator from VirtualBox app, wait a bit until you see a few lines like "init: untracked pid ... exited"
  3. Run the same emulator from Genymotion launcher.
  4. Now you can simulate mouse by moving it in VirtualBox app window (not genymotion window).

Depends on how long you wait before you do step 3, android can appear in genymotion or virtual box window.

Solution #2

  1. You need to install Genymotion emulator.
  2. Run VirtualBox app, go to your virtual box "android emulator":

    Settings -> Display -> Remote Display -> Check Enable Server
    
  3. Run android emulator through the genymotion launcher.
  4. Connect to your virtualbox with:

    $ rdesktop -a 16 localhost:3389
    

While you move cursor in rdesktop, you can see pointer in genymotion android emulator window. Now you can intercept hover events.

There is maybe a better solution - disable mouse integration for virtual machine, so, virtualbox can grab mouse cursor, like:

$ VBoxManage modifyvm "your-vm-name" --mouse ps2

but it doesn't work for me, maybe genymotion launcher overrides settings on every launch?

Links: http://developer.android.com/reference/android/view/View.OnHoverListener.html

p.s. hover events are available starting from api 14.

Upvotes: 3

Related Questions