I have a simple ImageButton
in my Android program which, when clicked, appends a "0" in a TextView
. When this button is long clicked, it is supposed to append "+" in that TextView
. The program works fine but I'm facing a typical key bouncing effect. When I long press the button, it do appends a "+", but when I release the button, it also appends a "0". It seems like Android registers a second single click when long click ends. How can I eliminate this? Here's what I'm doing:
ImageButton button0=(ImageButton)V.findViewById(R.id.imageButtonzero);
button0.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
enterNumber.append("0");
}
});
button0.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
enterNumber.append("+");
return false;
}
});
Thanks for your help!