title: How to handle touch event for child view in parent view
body: <p>I'm making a custom calendar view which extends LinearLayout and has child views for each date. What I want to do is handling swipe and click, as you can imagine, swipe is for changing month and click is for selecting a date and showing new activity. To do this, I use GestureDetector on CalendarView and could make it work for swipe. But to handle click event, I have no idea how to find a child view which click happened.</p>
  
  <ol>
  <li>Does anyone have any idea to resolve this?</li>
  <li>What's the difference between return true and false on OnScroll(MotionEvent)?</li>
  </ol>
  
  <p>Below is part of my codes.</p>
  
  <pre><code>public class MonthView extends LinearLayout implements GestureDetector.OnGestureListener {
  
      public MonthView(Context context, AttributeSet attrs, int defStyle) {
          super(context, attrs, defStyle);
          gestureDetector = new GestureDetector(this);
          initDateViews();
      }
  
      //other codes here
      ....
  
      private void initDateViews() {
          for(int i = 0; i &lt; 42; i++) {
              DateView view = new DateView();
              //init date views and add to calendar view.
              ....
              calendar.Add(view);
          }
      }
  
      @Override
      public boolean onTouchEvent(MotionEvent event) {
          Logger.debug(TAG, "&gt;&gt;&gt; MonthView.onTouchEvent()");
  
          return gestureDetector.onTouchEvent(event);
      }
  
      @Override
      public boolean OnSingleTapUp(MotionEvent event) {
          // how can I find a child view to handle click event?
      }
  
      @Override
      public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
          // right to left
          if (e1.getX() - e2.getX() &gt; minSwipeDistance) {
              this.prevMonth();
          }
          // left to right
          else if(e2.getX() - e1.getX() &gt; minSwipeDistance) {
              this.nextMonth();
          }
          // bottom to top
          else if(e1.getY() - e2.getY() &gt; minSwipeDistance) {
              this.prevMonth();
          }
          //top to bottom
          else if(e2.getY() - e1.getY() &gt; minSwipeDistance) {
              this.nextMonth();
          }
  
          return false;
      }
  
      ....
  }
  </code></pre>