When a mouse is plugged into Android device(no touch screen), there will be a classic mouse cursor shown on the screen, we can control the mouse to move cursor and click. We can get the current pointer location when mouse click(equal to "tap screen", ACTION_DOWN) by following code:
@Override
public boolean onTouchEvent(MotionEvent event) {
int x = (int)event.getRawX();
int y = (int)event.getRawY();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
//do something
case MotionEvent.ACTION_MOVE:
//do something
case MotionEvent.ACTION_UP:
//do something
}
return true;
}
But we get the pointer position when only mouse click action happen, can not get the mouse pointer position when it is moving on the screen by moving real mouse.
So my question is, how to get the mouse pointer location in this condition(NOT click mouse, just moving)?