title: Android: manage more touches in a general View
body: <p>In my app I want manage many touches inside the same view in this way:</p>
  
  <p>I want obtain the exact number of finger that are over this view, that is, if lay a finger my total should be 1, if I lay a second finger the total should be 2, and etc. for 3,4,5... (until my device support its max number of touches).
  It's ok but I want in real time also the total if I remove a finger from the screen, that is, if I layed 2 fingers over the screen ok the total is 2, but if I remove a finger the total should became 1.</p>
  
  <p>I create this code but it doesn't work fine.</p>
  
  <pre><code>touch_view = (View)findViewById(R.id.touch_view);
  
          touch_view.setOnTouchListener(new OnTouchListener() {
  
              @Override
              public boolean onTouch(View v, MotionEvent event) {
  
                  int action = event.getAction();
  
                  if (action == MotionEvent.ACTION_DOWN ){
  
                      touches++;
                      Log.i("", "touches "+ touches);
                      Log.i("", "action down");
  
                  }
                  else if (action == MotionEvent.ACTION_POINTER_DOWN){
                      touches++;
                      Log.i("", "touches "+ touches);
                      Log.i("", "pointer down");
                  }
                  else if (action == MotionEvent.ACTION_POINTER_UP){
                      touches--;
                      Log.i("", "touches " + touches);
                      Log.i("", "pointer up");
                  }
                  else if (action == MotionEvent.ACTION_UP){
  
                      touches--;
                      Log.i("", "touches " + touches);
                      Log.i("", "action up");
                  }
                  else if (action == MotionEvent.ACTION_CANCEL){
  
                      Log.i("", "cancel");
                  }
                  else if (action == MotionEvent.ACTION_HOVER_ENTER){
  
                      Log.i("", "action over enter");
                  }
                  else if (action == MotionEvent.ACTION_HOVER_EXIT){
  
                      Log.i("", "action over exit");
                  }
                  else if (action == MotionEvent.ACTION_OUTSIDE){
  
                      Log.i("", "action outside");
                  }
                  else if (action == MotionEvent.ACTION_POINTER_INDEX_MASK){
  
                      Log.i("", "index mask");
                  }
  
                  if (action != MotionEvent.ACTION_MOVE){
                      Log.i("","pointer count"+event.getPointerCount());
                      Log.i("","action type" +event.getAction());
                  }
  </code></pre>
  
  <p>I notice that my count "touches" doesn't work well... and sometimes my log "event.getAction()" give me a strange number (261, 262...517,518...) what type of action are these numbers?
  Can you help me?</p>