How to avoid double click on my example, any solutions?
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.testing) {
Dialog();
return super.onOptionsItemSelected(item);
}
There is many way to achieve this. I am telling only sample example.
Just create a boolean variable in Activity class.
Boolean isClicked = false;
and then
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.testing) {
if (!isClicked){
//Change here as your flag is true
isClicked = true;
Dialog();
}
return super.onOptionsItemSelected(item);
}
Then this dialog shows only one time. If any changes needed ask.
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