I am trying to handle touch events and click events on a button. I do the following:
button.setOnClickListener(clickListener);
button.setOnTouchListener(touc
button.setOnTouchListener(this);
Implement interface and the code here:
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (view.getId()) {
case R.id.send:
switch(motionEvent.getAction()){
case MotionEvent.ACTION_DOWN:
//when the user has pressed the button
//do the needful here
break;
case MotionEvent.ACTION_UP:
//when the user releases the button
//do the needful here
break;
}
break;
}
return false;
}