How do you disable multiple clicks on a menu option, before the first click is processed?
You can set the visibility or enable/disable the item by code.
MenuItem item = menu.findItem(R.id.your_item);
item.setVisible(true);
item.setEnabled(false);
Of course you have to check somewhere whether to enable oder disable the icon.
Psuedo/Android answer:
private boolean clicked = false;
@Override
public onClick(View v){
if(!clicked){
clicked = true;
// do your processing - one click only
super.onClick();
}
}
EDIT
or even better after the first click you can call yourView.setOnClickListener(null);
to remove the onClick
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With