Why would dynamically changing the stroke type of a GestureOverlayView cause unusual behaviour?
- by Rob Kent
I recently introduced multi-stroke gestures into my application. This is a preference so I set the StrokeType dynamically in Activity.OnCreate. What I have discovered is that if you change the StrokeType so that it is different to the setting in the layout file, it changes the behaviour of the GestureOverlayView in the following way.
The normal behaviour is that you draw a gesture and it stays on the screen after it is drawn. When you change the stroke type dynamically however, any gesture drawn on the screen disappears immediately after the OnGestureEnded event has fired. I reloaded the sample GesturesBuilder application and confirmed it has the same problem if you add the second line shown here:
GestureOverlayView overlay = (GestureOverlayView) findViewById(R.id.gestures_overlay);
overlay.setGestureStrokeType(GestureOverlayView.GESTURE_STROKE_TYPE_SINGLE);
overlay.addOnGestureListener(new GesturesProcessor());
}
The default in the layout is MULTIPLE but changing it to single changes the behaviour. If you keep the above line but set it to what it already is, the behaviour is not affected.
Is this a bug in the Android gestures library and does anyone know a workaround?
Note that this is on an HTC Magic so it could also be a handset issue.