Code example for GestureDetector

Methods: setIsLongpressEnabled

0
 
	private float mStepFor1xScale;
	private ScaleGestureDetector mDelegate;
	public ScaleGestureDetector16(Context context, ScaleGestureDetector del) {
		mDelegate = del;
		mGestureDetector = new GestureDetector(context, new InternalListener());
		mGestureDetector.setIsLongpressEnabled(true);
		final Context ctx = context;
		if (ctx.getPackageManager().checkPermission(permission.VIBRATE, ctx.getPackageName()) == PackageManager.PERMISSION_GRANTED) {
			mVibrator = (Vibrator) ctx.getSystemService(Context.VIBRATOR_SERVICE);
		} else { 
			Log.w(TAG, "add permission " + permission.VIBRATE + " for haptic feedback!");
		} 
 
		calibrateScaleSpace(ctx);
	} 
 
	private void calibrateScaleSpace(Context ctx) {
		final WindowManager wm = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE);
		final int displayHeight = wm.getDefaultDisplay().getHeight();
Contextual code suggestions in your IDE  Get Codota for Java