title: how to get value after the last multiclique in android
body: <p>I am creating an application, but I am not able to do the following:
  I have a button that increments a variable and a button that decrements and saves the value in the database through php and shows in a textview. What I am trying to do is that when the increment (or decrement) button receives multiple clicks, it will save only the last incremental value.
  Example:</p>
  
  <pre><code>    btn_UP.setOnClickListener (new View.OnClickListener () {
              @Override
              public void onClick (View v) {
                  if (temperature &lt;32)
                      temperature ++;
                      txtTemp.setText ("" + temperature);
                  }
              }
  
          });
  
  btn_DOWN.setOnClickListener (new View.OnClickListener () {
              @Override
              public void onClick (View v) {
                  if (temperature&gt; 17)
                      temperature--;
                      txtTemp.setText ("" + temperature);
                  }
              }
          });
  </code></pre>
  
  <p>This way I'm doing it, it increases and decreases with each click made in the button, but when receiving multiple clicks, it also does the same, however I would like it to continue incrementing and only when the multicliques finishes that the value was displayed and saved in the database.</p>
  
  <p>I tried to do the following and it did not work as expected:</p>
  
  <blockquote>
    <p>link: <a href="https://stackoverflow.com/questions/5608720/android-preventing-double-click-on-a-button">Android Preventing Double Click On A Button</a></p>
  </blockquote>
  
  <pre><code>public class Activity ... {
   
      private long mLastClickTime = 0;
  
   
      protected void OnCreate ... {
  
      btn_tempUP.setOnClickListener (new View.OnClickListener () {
              @Override
              public void onClick (View v) {
                  if (SystemClock.elapsedRealtime () - mLastClickTime &lt;500) {
                      
          return;
                  }
                  mLastClickTime = SystemClock.elapsedRealtime ();
  
                  if (temperature &lt;32)
                      temperature ++;
                      txtTemp.setText ("" + temperature);
                  }
              }
  
          });
  
  
      }
  
  }
  </code></pre>
  
  <p>Can someone help me with how to do this? If I could be clear.</p>