This exemple may help you http://android-journey.blogspot.com/2010/01/android-gestures.html
On Apr 24, 6:49 pm, powder <andr...@unidevsolutions.com> wrote: > Hi, > > I have a piece of code that enables me to detect fling/swipe left and > right, thereby calling moveLeft() and moveRight(). > This works fine in a normal Activity and ListActivity. When the > ListActivity screen is fully filled with entries this code > does not pick up the fling/swipe, but instead triggers the > > protected void onListItemClick(ListView l, View v, int position, long > id) { > > How can I code this both allowing fling/swipe left and right and also > detecting onListItemClick? > > Regards Jonas. > > mGestureDetector = new GestureDetector(context, new > GestureDetector.SimpleOnGestureListener() { > public boolean onFling(MotionEvent e1, MotionEvent e2, > float velocityX, float velocityY) { > int dx = (int) (e2.getX() - e1.getX()); > > if (Math.abs(dx) > MAJOR_MOVE && Math.abs(velocityX) > > Math.abs(velocityY)) { > if (velocityX > 0) { > moveRight(); > } else { > moveLeft(); > } > return true; > } else { > return false; > } > } > }); > > -- > 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 > athttp://groups.google.com/group/android-developers?hl=en -- 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