I would like to create a CustomButton which has a predefined onClick.
In fact, my object would do the same job than
CustomButton mB
In your button class just implement:
@Override
public void onClick(View v) {
showSomething();
}
Or if you want more granular control:
@Override
public boolean onTouchEvent(MotionEvent event) {
showSomething();
}
You can either implement your click logic in the method by checking the event.getAction(), or send it to a GestureDetector to figure out when a click has been performed.