Reputation: 413
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.
Upvotes: 0
Views: 1561