title: How do I count the number of times I tap the screen with onTouchListener?
body: <p>I'm using a wearable device and I'm making an app for it. I have a timer and some other things that begin when I click a start button. Thing is the start button occupies some space that makes things look crowded. I used a Wearable Action Drawer but it doesn't look good, so I resorted to using onTouchlistner with the view in which my objects like the timers are placed.</p>
  <p>The layout is a FrameLayout. Now when I use the onTouchListner the MotionEvent I detect is the ACTION_DOWN how do I count this happening 2 times in order to start whatever it is I want to start and when it's 4 times I call my AlertDialog?</p>
  <pre><code>frameLayout = (FrameLayout)findViewById(R.id.myscreen);
      frameLayout.setOnTouchListener(new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
              int x = (int) event.getX();
              int y = (int) event.getY();
              clicked = clicked + 1;
              if(event.getAction() == MotionEvent.ACTION_DOWN)
              {
                  startTimer();
                  //Check flow rate
                  if(num == 450)
                  {
                      try {
                          flow.setText(String.valueOf(num));
                          progressBar.setIndeterminateDrawable(Circle);
                          progressBar.setVisibility(View.VISIBLE);
                      } catch (NullPointerException e) {
                          e.printStackTrace();
                      }
                  }
                  else if(num == 150)
                  {
                      try {
                          flow.setText(String.valueOf(num));
                          progressBar.setIndeterminateDrawable(Circle);
                          progressBar.setVisibility(View.VISIBLE);
                      } catch (NullPointerException e) {
                          e.printStackTrace();
                      }
  
                  }
  
              }
              else if(event.getAction() == MotionEvent.ACTION_DOWN &amp;&amp; clicked == 4)
              {
  
                  Handler mHandler = new Handler(Looper.getMainLooper());
                  mHandler.post(new Runnable() {
                      @Override
                      public void run() {
                          // Your UI updates here
                          AlertMessage();
                      }
                  });
  
              }
  
              return true;
          }
      });
  </code></pre>
  <p><em>clicked</em> is an integer initialized by zero I used that when I was using buttons to count my number of clicks. I now want to count the number of taps to my screen, so if 2 taps ----&gt;start if 4 taps -------&gt; call AlertDialog</p>