0

I have a bluetooth mouse connected to my phone (galaxy s2, Android 4.1). I'm trying to get the cursor position and display it in a TextView using the OnHoverListener:

private class MouseListener implements View.OnHoverListener {
    @Override
    public boolean onHover(View view, MotionEvent motionEvent) {
        String position = motionEvent.getX() + "  " + motionEvent.getY();
        mousePosition.setText(position);

        return false;
    }
}

This is set on a RelativeLayout:

layout.setOnHoverListener(new MouseListener());

The problem is that it only updates when I click and not when I move the mouse.

Jeroen
  • 413
  • 1
  • 4
  • 16

1 Answers1

1

The code is correct. I tried it with another mouse and it works.

Jeroen
  • 413
  • 1
  • 4
  • 16