MyScrollView.java :  » Widget » apwidgets » apwidgets » Android Open Source

Android Open Source » Widget » apwidgets 
apwidgets » apwidgets » MyScrollView.java
package apwidgets;

import processing.core.PApplet;
import android.view.MotionEvent;
import android.widget.ScrollView;

public class MyScrollView extends ScrollView{

  PApplet pApplet;
  public MyScrollView(PApplet pApplet) {
    super(pApplet);
    this.pApplet = pApplet;
    // TODO Auto-generated constructor stub
  }
  //Should only be passed if Android ver 2.2, cause then the calls 
  //are obscured by the overlying ViewGroup and never reach the
  //processing surfaceTouchEvent and the mousePressed etc is
  //never called
  public boolean onTouchEvent(MotionEvent evt){
    pApplet.surfaceTouchEvent(evt);//pass on to processing
    return super.onTouchEvent(evt);//calling super makes the scrolling work
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.