[android - Solution]click Two Button In A Same Time In Android
I have a problem in Android code. I have two button in an fragment: Button buttonOne = (Button) findViewById(...); Button buttonTwo = (Button) findViewById(...); buttonOne will sh
Solution 1:
You can create a timer which will act as a threshold before you can click another button again.
example:
@OverridepublicvoidonClick(View v) {
// Preventing multiple clicks, using threshold of 1 secondif (SystemClock.elapsedRealtime() - mLastClickTime < 500) {
return;
}
mLastClickTime = SystemClock.elapsedRealtime();
///YOUR BUTTON CLICK HERE
}
So it will have a threshold of 500 millisecond before you can click another button
Post a Comment for "[android - Solution]click Two Button In A Same Time In Android"