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
Raiden
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified

How to detect double touch on Storm ?

Hi guys,

 

I am trying to rotate the image by 2 fingers. If user makes a circular motion by 2 fingers on the screen, it should rotate the background image.

 

How to make this issue ?

The main problem is I don't have a Storm device. Can I test it on the simulator ?

 

Please share the knowledge.

 

Thanks in advance.

Please use plain text.
Developer
mlamagra
Posts: 204
Registered: ‎07-09-2009
My Device: Not Specified

Re: How to detect double touch on Storm ?

Storm1 cannot track 2 fingers.  Storm2 can, and assume Torch can also.  Use getX(1) and getX(2) etc. to get the coords for the 1st and 2nd fingers.

 

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1154, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: How to detect double touch on Storm ?

Storm 1 can track two fingers.

 

On the simulator there should be an option for multitouch. When you use that you control each finger individually. First finger one (it leaves a ghost trail) and then finger two (the ghost trail will play as you do this). When either one finishes the multitouch event will play through.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
mreed
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: How to detect double touch on Storm ?

Just an FYI: I believe it will only support two fingers for the MOVE event, though (possibly SWIPE? Haven't tried that one). So if you are trying to look for two fingers on any other event (like DOWN), the second finger will return -1 for the x/y.

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1154, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: How to detect double touch on Storm ?

Yes that is correct. Touch events are one at a time. Move will store point information so you can retrieve more then one point at a time. Also, as of 6.0, only two points are supported (I think someone else mentioned this).

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
Developer
CMY
Posts: 1,123
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: How to detect double touch on Storm ?

Also, you cannot cross fingers or it will mess up the touch points. Example, if you cross your fingers moving left/right and the left finger is touch point 1, when they cross the finger moving right will now be touch point 1.

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1154, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: How to detect double touch on Storm ?

For me that depends. I can't get it to constantly happen.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
Raiden
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified

Re: How to detect double touch on Storm ?

Thank you guys.

 

There is an option "Multitouch Mode (short key is Alt + T) ". I will try this. Then post the result back.

 

I am using simulator of 9530.

Please use plain text.
Developer
Raiden
Posts: 490
Registered: ‎07-16-2008
My Device: Not Specified

Re: How to detect double touch on Storm ?

Guys.

I think the best event which can catch circular motion is :

 

 

//In field TouchEvent implementation :

if(TouchEvent.getEvent() == TouchEvent.GESTURE) {
   TouchGesture gesture = message.getGesture();
   if(gesture.getEvent == TouchGesture.SWIPE) {
      int degree = gesture.getSwipeAngle();
      //Rotate the image in degree.  
   }
}

 

 

Above code is very simple. But I don't know how to make this event on the simulator.

Please suggest guys.

 

Thanks.

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1154, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: How to detect double touch on Storm ?

I'm not sure that will work. A swipe gesture is moving across the screen and lifting your finger as you move.

 

A better one might be to catch a move event, take the source and dest points, calculate slope, and use trig to figure out angle.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.