What is meaning of boolean value returned from an event-handling method in Android
If you return true
from an ACTION_DOWN
event you are interested in the rest of the events in that gesture. A "gesture" in this case means all events until the final ACTION_UP
or ACTION_CANCEL
. Returning false
from an ACTION_DOWN
means you do not want the event and other views will have the opportunity to handle it. If you have overlapping views this can be a sibling view. If not it will bubble up to the parent.
From the documentation : http://developer.android.com/reference/android/view/View.OnTouchListener.html#onTouch(android.view.View, android.view.MotionEvent)
"True if the listener has consumed the event, false otherwise."
If you return true, the event is processed. If false, it will go to the next layer down.
The boolean value determines whether the event is consumed or not.
Yes you're correct. If you return false, the next listener handles the event. If it returns true, the event is consumed by your listener and not sent to the next method.