The Android input event documentation here seems to imply that returning false in an event listener will cause the event to continue on to other listeners. For example
OnTouchListener touchListener = new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// should continue on to other views
return false;
}
};
The problem is if I have two buttons in the same layout and I click on one I would expect the event to continue on to all views since I'm returning false, for example:
Button submitButton = (Button) findViewById(R.id.submit_button);
submitButton.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
System.out.println("--> submitButton");
return false;
}
});
Button clearButton = (Button) findViewById(R.id.clear_button);
clearButton.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
System.out.println("--> clearButton");
return false;
}
});
Since the submit button's listener returns false I would expect the click result to be sent on to the clear button but the output is always:
--> submitButton
--> submitButton
Can someone explain how events are propagated within a view since I seem to be misunderstanding the article?