title: how to implement double click in android
body: <p>I am doing a project in which i want to display  a particular message on single  touch and another message on double touch using android.How can i implement it.</p>
  <p>My sample code is below</p>
  <pre><code>if(firstTap){
              thisTime = SystemClock.timeMillis();
              firstTap = false;
          }else{
              prevTime = thisTime;
              thisTime = SystemClock.uptimeMillis();
  
              //Check that thisTime is greater than prevTime
              //just incase system clock reset to zero
              if(thisTime &gt; prevTime){
  
                  //Check if times are within our max delay
                  if((thisTime - prevTime) &lt;= DOUBLE_CLICK_MAX_DELAY){
  
                      //We have detected a double tap!
                      Toast.makeText(AddLocation.this, &quot;DOUBLE TAP DETECTED!!!&quot;, Toast.LENGTH_LONG).show();
                      //PUT YOUR LOGIC HERE!!!!
  
                  }else{
                      //Otherwise Reset firstTap
                      firstTap = true;
                  }
              }else{
                  firstTap = true;
              }
          }
          return false;
  </code></pre>