Cannot capture TouchEvent.UP in Blackberry
Posted
by Nandu
on Stack Overflow
See other posts from Stack Overflow
or by Nandu
Published on 2010-02-27T08:04:08Z
Indexed on
2010/03/22
6:51 UTC
Read the original article
Hit count: 390
I am working on a Scrollable Image field.I am handling TouchEvent.DOWN mTouchEvent.MOVE,TouchEvent.UP. Somehow control never goes to TouchEvent.UP section.How to capture the UP event. I have to findout the start and end points of the drag.
My Code looks like this..
if (event == TouchEvent.DOWN && touchEvent.isValid())
{
_xTouch = touchEvent.getX(1);
_yTouch = touchEvent.getY(1);
}
else if(event == TouchEvent.UP && touchEvent.isValid())
{
int x = touchEvent.getX(1);
int y = touchEvent.getY(1);
}
else if (event == TouchEvent.MOVE && touchEvent.isValid())
{
boolean result = scrollImage((touchEvent.getX(1) - _xTouch), (touchEvent.getY(1) - _yTouch));
_xTouch = touchEvent.getX(1);
_yTouch = touchEvent.getY(1);
//If scrolling occurred, consume the touch event.
if (result)
{
return true;
}
else
{
return false;
}
}
Thanks in advance.
© Stack Overflow or respective owner