Actually I've found the following works well:
@Override
public boolean dispatchTouchEvent(MotionEvent ev){
gd.onTouchEvent(ev);
return super.dispatchTouchEvent(ev);
}
calling super.dispatchTouchEvent allows all of the other views to
receive their events.
For some reason, in my layouts, onTouch is never called for the
Activity, so this is the only way I've found to detect gestures on the
Activity.
On Nov 3, 4:07 pm, Rohit Mordani <[EMAIL PROTECTED]> wrote:
> yi, doing that will disable all normal touch event dispatching for
> that view and any of its children. It's really rare that you should
> override a dispatch method, especially doing so and never calling
> through to the super class.
>
> The correct thing is almost always to override onTouchEvent().
>
> Rohit
>
> On Oct 31, 1:05 pm, Rohit Mordani <[EMAIL PROTECTED]> wrote:
>
> > In addition you need to do the following in your view:
>
> > @Override
> > public boolean dispatchTouchEvent(MotionEvent ev){
> > return mGestureDetector.onTouchEvent(ev);
>
> > }
>
> > Thanks
> > Rohit
>
> > On Oct 31, 2:01 pm, Rohit Mordani <[EMAIL PROTECTED]> wrote:
>
> > > I got fling/swipe to work. In one of my other posts someone told me to
> > > do the following to make the onFling and Scroll methods to be called:
>
> > > 1) Set View.setLongClickable to true for the view you are using
> > > 2) Set GestureHandler.setIsLongpressEnabled to true
> > > 3) Return true in your onDown method
>
> > > Thanks for all the help
> > > Rohit
>
> > > On Oct 30, 5:12 pm, Romain Guy <[EMAIL PROTECTED]> wrote:
>
> > > > A fling is just an ACTION_DOWN, one or more ACTION_MOVE and an
> > > > ACTION_UP. It has nothing to do with running in the emulator or not.
> > > > (For what it's worth, a large part of the touch UI and APIs have been
> > > > developed in the emulator.)
>
> > > > On Thu, Oct 30, 2008 at 4:18 PM, Rohit Mordani <[EMAIL PROTECTED]>
> > > > wrote:
>
> > > > > I THINK the problem is that in the emulator, pressing the left mouse
> > > > > button is more like a tap and that sets the MotionEvent.Action to be
> > > > > ACTION_DOWN. As a result the onDown() method of the OnGestureListener
> > > > > is called instead of onFling(). There might be a way to emulate the
> > > > > fling in the emulator but I am not sure of it. If anyone finds out
> > > > > then please let me know. That would then call onFling() correctly I
> > > > > think
>
> > > > > Rohit
>
> > > > > On Sep 22, 6:40 am, kingtut <[EMAIL PROTECTED]> wrote:
> > > > >> Any luck in getting the onFling or onScroll event to fire? I am
> > > > >> facing
> > > > >> the same problem.
>
> > > > >> On Sep 12, 5:14 pm, Mark Hansen <[EMAIL PROTECTED]> wrote:
>
> > > > >> > Ok, I'll keep trying it.. for some reason the events aren't firing
> > > > >> > such as Fling etc.
>
> > > > >> > On Sep 12, 10:12 am, Kavi <[EMAIL PROTECTED]> wrote:
>
> > > > >> > > ListView is a kind of View, so you should be able to attach the
> > > > >> > > GestureDetector to your ListView as well.
>
> > > > --
> > > > Romain Guywww.curious-creature.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---