try using GestureDetector...

u get functions like onScroll which  shud make ur work easier.

On Tue, Jul 7, 2009 at 3:57 PM, Suhas <suhas.ga...@gmail.com> wrote:

> Hi
> I think u should return true and not false in ontouchevent
>
>
> On Tue, Jul 7, 2009 at 3:51 PM, zeeshan <genx...@gmail.com> wrote:
>
>>
>> Hi dear,
>>
>> i need left, right  motion event and a click event .
>> problem is that, if i have onclickEvent then onTouchEvent doesn't
>> fire.
>> onTouchEvent works only if i disable onclickEvent and also it doesn't
>> work what i expect.
>>
>> 1-only ACTION_MOVE fires twice everytime when i move on screen.
>> 2-can't get left and right motion
>>
>> please figure what is wrong in the code below:
>>
>> @Override
>>                public boolean onTouchEvent(MotionEvent event) {
>>
>>                        switch (event.getAction()) {
>>                    case MotionEvent.ACTION_DOWN:
>>                       startX = (int)event.getX();
>>                       startY = (int)event.getY();
>>                       return true;
>>                    case MotionEvent.ACTION_MOVE:
>>                       endX = (int)event.getX();
>>                       endY = (int)event.getY();
>>                        if((endX - startX) > 0) {
>>                       //right
>>                       }
>>                       if((endX - startX) < 0) {
>>                       //left
>>                       }
>>                       startX = (int)event.getX();
>>                       startY = (int)event.getY();
>>
>>                       return true;
>>                    case MotionEvent.ACTION_UP:
>>                       endX = (int)event.getX();
>>                       endY = (int)event.getY();
>>                       return true;
>>                    }
>>                    return false;
>>                }
>>
>>
>>
>> thanks in advance
>>
>>
>
>
> --
> Regards,
> Suhas Gavas
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to