Tutorial by Examples

Touch events related to a Button can be checked as follows: public class ExampleClass extends Activity implements View.OnClickListener, View.OnLongClickListener{ public Button onLong, onClick; @Override public void onCreate(Bundle sis){ super.onCreate(sis); setCon...
Touch event handler for surfaces (e.g. SurfaceView, GLSurfaceView, and others): import android.app.Activity; import android.os.Bundle; import android.view.MotionEvent; import android.view.SurfaceView; import android.view.View; public class ExampleClass extends Activity implements View.OnTouc...
public class CustomSurfaceView extends SurfaceView { @Override public boolean onTouchEvent(MotionEvent e) { super.onTouchEvent(e); if(e.getPointerCount() > 2){ return false; // If we want to limit the amount of pointers, we return false //...

Page 1 of 1