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
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380
My Carrier: Vodafone

Swipe in java.

Hi all,

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

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

Re: Swipe in java.

Hi SumiGhosh,

 

Are you taking abut touch swipe or anything else?

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

Re: Swipe in java.

Yes - TouchGesture.SWIPE

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

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);
}