I'm working with the Blackberry Touch Event and I need to process the TouchEvent.MOVE
, TouchEvent.UP
and TouchEvent.DOWN
to move a carousel of images and the TouchEvent.CLICK
to generate some specific action.
My problem is that the touchEvent()
method is being called several times. How can I prevent this? Because the behaviour is getting all messed up.
For example: when I just want to capture the TouchEvent.CLICK
event, the UP-DOWN-MOVE-CLICK are being triggered one after the next.
My code does the following:
protected boolean touchEvent(TouchEvent message) {
if (message.getEvent() == TouchEvent.CLICK) {
//CHANGE THE CONTENT OF A FIELD
return true;
} else if ((message.getEvent() == TouchEvent.MOVE)
|| (message.getEvent() == TouchEvent.UP)
|| (message.getEvent() == TouchEvent.DOWN)) {
//DELETE THE FIELD
//MOVE A CAROUSEL OF IMAGES
} else {
return false;
}
}
public void moverTouch(int dx) {
//ADD THE FIELD PREVIOUSLY DELETED
}
As you can see, when the CLICK
event is captured, I need to change the content of a field, but when the MOVE
or UP
or DOWN
event is captured, I need to delete that Field
from his manager, do some working with a carousel of images, and then re-add the field previously deleted.
The carousel moving part works fine, but when I try to capture JUST the CLICK
event, and the others are being triggered as well, but the moverTouch(
) function doesn't get triggered because there is no actual movement on the carousel of images, I end up with a deleted field that I need to update its content.