title: How to prevent rapid double click on a button
body: <p>I have looked at the answers here - <a href="https://stackoverflow.com/questions/5608720/android-preventing-double-click-on-a-button">Android Preventing Double Click On A Button</a>
  and implemented qezt's solution like and I've tried <code>setEnabled(false)</code> like so - </p>
  
  <pre><code>doneButton.setOnClickListener(new View.OnClickListener() {
      @Override
          public void onClick(View v) {
  
              // mis-clicking prevention, using threshold of 1 second
              if (SystemClock.elapsedRealtime() - doneButtonClickTime &lt; 1000){
                  return;
              }
  
              //store time of button click
              doneButtonClickTime = SystemClock.elapsedRealtime();
  
              doneButton.setEnabled(false);
  
              //do actual work 
  
          }
      });
  </code></pre>
  
  <p>Neither of these work against super fast double clicks. </p>
  
  <p>Note - I'm not setting <code>doneButton.setEnabled(true)</code> after my processing is done. I simply finish() the activity so there is no issue of the button getting enabled too soon.</p>