Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
SumiGhosh
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380

Swipe in java.

Hi all,

 is there a Swipe functionality in BlackBerry java. Can anyone help me any tutorial for that.

Developer
hemant_sain
Posts: 180
Registered: ‎12-09-2011
My Device: 9360, BB10

Re: Swipe in java.

Hi SumiGhosh,

 

Are you taking abut touch swipe or anything else?

Developer
pbrebs
Posts: 40
Registered: ‎09-08-2011
My Device: 8900

Re: Swipe in java.

Yes - TouchGesture.SWIPE

Developer
hemant_sain
Posts: 180
Registered: ‎12-09-2011
My Device: 9360, BB10

Re: Swipe in java.

go through this link:

 

http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/ui/TouchGesture.html

 

and you can use this small code also:

 

protected boolean touchEvent(TouchEvent message) {
switch(message.getEvent()) {
case TouchEvent.GESTURE:
TouchGesture gesture = message.getGesture();
switch(gesture.getEvent()) {
case TouchGesture.SWIPE:
if(gesture.getSwipeDirection() == TouchGesture.SWIPE_EAST) {
Dialog.alert("Eastward swipe occurred");
return true;
} else if(gesture.getSwipeDirection() == TouchGesture.SWIPE_WEST) {
Dialog.alert("Westward swipe occurred");
return true;
}
}
}
return super.touchEvent(message);
}