title: listening to scroll events horizontalscrollview android
body: <p>I am trying to listen to the event when the <code>HorizontalScrollView</code> is scrolled. Tried this but it does not print anything.</p>
  
  <pre><code>HorizontalScrollView headerScrollView = new HorizontalScrollView(this);
  
      headerScrollView.setOnTouchListener(new OnTouchListener() {
  
          @Override
          public boolean onTouch(View v, MotionEvent event) {
              // TODO Auto-generated method stub
              Log.i("hv1",event.toString());
              Log.i("hv1","HELLO");
              return false;
          }
      });
  </code></pre>
  
  <p>The actual problem is, I want to scroll two <code>HorizontalScrollView</code> at a time..ie; both of them need to scroll simultaneously when atleast one of them scrolled.
  any workaround?</p>
  
  <p>I used the answer below and then tried implementing this but I am not sure how I need to use the methods in the class.</p>
  
  <pre><code>TestHorizontalScrollView headerScrollView = (TestHorizontalScrollView) findViewById(R.id.headerHv); 
  </code></pre>
  
  <p>Is this the way I need to point to the hsv element in the layout file? </p>