Blackberry Touch Event Launches Several Times

I work with a Blackberry Touch Event, and I need to process TouchEvent.MOVEit TouchEvent.UPboth TouchEvent.DOWNto move the carousel of images and TouchEvent.CLICKto create a specific action.

My problem is that the method touchEvent()is called multiple times. How can I prevent this? Because the behavior is all messed up.

For example: when I just want to capture an event TouchEvent.CLICK, UP-DOWN-MOVE-CLICK fires one after another.

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
}

, CLICK , , MOVE UP DOWN , Field , , .

, JUST CLICK, , moverTouch() , , .

+1
1

:

, ( , "" - ) "" ( , TouchEvent.CLICK, " " ).

, TouchEvent, TouchEvent.GESTURE. , TouchGesture , TouchEvent.getGesture().

.

+3

All Articles