views:

91

answers:

1

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.

A: 

:)

it was a misunderstanding.I was handling the touch event in multiple layers..like Field level,layout manager level and screen level. So in particular case..it was being cosumed by manager.And i need the event to be cosumed by field. It was a mistake in return value.

Nandu