i'm using the GestureDetector and GestureListener in a program. i want to have separate actions for the onFling and onScroll events. for a "scroll" event there is no problem - only the onScroll event is called. however for a "fling" event BOTH the onFling and onScroll events are being called. i tried returning "true" in the onFling method to prevent further propagation of the event but that didnt help. following is the code excerpt from the onTouchEvent and the related gesture events:
private static boolean fling, scroll; //two boolean values to detect whether the performed action is a fling or scroll private GestureDetector scanner; //this is the gesture detector public boolean onTouchEvent(MotionEvent me){ fling = false; scroll = false; scanner.onTouchEvent(me); if (fling) { scroll = false; return true; } else if (scroll){ return true; } return super.onTouchEvent(me); } public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { fling = true; return false; //changing this to return true at this point makes no difference } public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { scroll = true; return false; } what i tried in the onTouchEvent method above is to put a kind of a "lock" so that if a "fling" is detected then the appropriate action is taken and the event is not propagated further. however despite trying every combination of returning true / false in each of the above methods, i am unable to separate out the "fling" event from the "scroll" event. as i said - there is no problem in the conventional scroll - in this case only the action for scroll is being performed. for the gesture events, is there any particular sequence in which the event is propagated? i.e. does it first go to the onClick, then the onFling, then the onScroll ... etc? any inputs will be greatly appreciated --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---