Question

There are several types of input events, in which touch event and hover event are both included.

final int source = q.mEvent.getSource();
if ((source & InputDevice.SOURCE_CLASS_POINTER) != 0) {
    deliverPointerEvent(q);
} else if ((source & InputDevice.SOURCE_CLASS_TRACKBALL) != 0) {
    deliverTrackballEvent(q);
} else {
    deliverGenericMotionEvent(q);
}

The code above is a portion of function deliveryInputEvent(...). The two types are processed separately.

  1. touch event is touching screen by hands and hover event is touching screen by a stylus pen, is that right?
  2. How can devices differ one from the other?
  3. Assuming the device can tell one from the other, I think the two events are similar, why do we process them serparately?
Was it helpful?

Solution

The latest devices have touchless sensors that will detect digits or stylus that are close to the screen but not touching. These are to be used for preview functions like tooltips and small thumbnails.

This technology is dark magic and should not be toyed with lightly.

I expect that most of the time, smaller developers will only have the resources to process the touch events.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top