Code example for GestureDetector.SimpleOnGestureListener

0
import android.widget.LinearLayout; 
 
public class TouchHandlerLayout extends LinearLayout {
 
	private GestureDetector gDetector;
	private SimpleOnGestureListener sl = new SimpleOnGestureListener();
 
	private void createDetector(Context context) {
		gDetector = new GestureDetector(sl);
	} 
 
	public TouchHandlerLayout(Context context) {
		super(context);
		createDetector(context);
	} 
 
	public TouchHandlerLayout(Context context, AttributeSet attributeSet) {
		super(context, attributeSet);
		createDetector(context);
 
	}