I have a custom TextView that can be clicked. He defines his own onClick handler to change its look based on clicks. However, if I then define a second onClick handler in my activity to do something based on the click of a button, only one of the onClick functions is called. onClick is a void function - is there a way to say that I did not handle this click, please pass it on to other onClick handlers?
More clear is the code:
Inside MyCheckButton, which extends TextView, I:
setOnClickListener( mClickListener ); private OnClickListener mClickListener = new OnClickListener() { public void onClick(View v) { toggle(); } };
However, I include MyCheckButton in my activity, and, of course, I need to do something when it is clicked, so I attach another OnClickListener to it:
MyCheckButton button= (MyCheckButtonButton) findViewById(R.id.cb); button.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) {
By calling setOnClickListener twice, it seems like I'm replacing the original listener so that toggle () changes the look that is never called. How can I do something in my activity when this button is pressed, if it already uses the onClick handler to change its appearance? I thought I would just see how OnClickListeners would be called.
user317033
source share