10-21-2011 09:44 AM
Hi,
How can we handle multi touch in Torch.
My requirement is expanding and compresing the MAP. Here i am using below code (putting dialog box for testing). but in any condition or any moment that dialog box is not executing.Please help me....
if(event == TouchEvent.GESTURE)
{
processGesture(touchEvent);
return true;
}
return super.touchEvent(touchEvent);
}
private void processGesture(TouchEvent _event)
{
int pevent = _event.getGesture().getEvent();
if(pevent == TouchGesture.PINCH_UPDATE || pevent == TouchGesture.PINCH_BEGIN || pevent == TouchGesture.PINCH_END)
{
Dialog.alert("Hi");
}
}
Thanks in Advance.....
10-21-2011 11:25 AM
It might be one of the following:
1. Your if condition is not met - can be easily cheked with a debugger.
2. A UI issue - You would have to use one of the invoke functions (invokeLater or invokeAndWait) or to lock the eventLock: synchronized (Application.getEventLock{Dialog.alert("hi");})
E.
10-21-2011 11:28 AM - edited 10-21-2011 11:29 AM
actually ichanged my code like below, but i got -1 is coming for x2 and y2.
InputSettings inputSetting = TouchscreenSettings.createEmptySet();
inputSetting.set(TouchscreenSettings.DETECT_PINCH
if(this.getScreen() != null)
this.getScreen().addInputSettings(inputSetting);
int touchX1 = _event.getX(1);
int touchX2 = _event.getX(2);
int touchY1 = _event.getY(1);
int touchY2 = _event.getY(2);
int pevent = _event.getGesture().getEvent();
if(pevent == TouchGesture.PINCH_BEGIN )
{
Dialog.alert("PinchBegin.Touchx1:"+touchX1+" TouchX2:"+touchX2+" TouchY1:"+touchY1+" TouchY2:"+touchY2);
}
if(pevent == TouchGesture.PINCH_END)
{
Dialog.alert("PinchEnd");
}
Thanks in advance...
10-22-2011 12:40 AM
Hi,
inputSetting.set(TouchscreenSettings.DETECT_PINCH,
if(this.getScreen() != null)
this.getScreen().addInputSettings(inputSetting);
This code is not suitable for jre 5.0
can any one help me....
thanks in advance...