Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of "onFling" and "onScroll" event in GestureDetector of Android?

I am developing an Android application. I am novice in Touch enabled Android Application. I have read the article about onFling and onScroll events on:

http://developer.android.com/reference/android/view/GestureDetector.OnGestureListener.html

But I didn't get exactly what is the meaning and for what we can use onFling and onScroll events.

like image 633
Paresh Mayani Avatar asked Jul 02 '10 06:07

Paresh Mayani


People also ask

What is onFling Android?

onFling: is that the user lifts his finger in the end of the movement (that is the reason for what onFling is called one time).

What does the GestureDetector Ongesturelistener interface do when implemented?

GestureDetector. SimpleOnGestureListener provides an implementation for all of the on<TouchEvent> methods by returning false for all of them. Thus you can override only the methods you care about. For example, the snippet below creates a class that extends GestureDetector.

What is touch gestures in Android?

A "touch gesture" occurs when a user places one or more fingers on the touch screen, and your application interprets that pattern of touches as a particular gesture. There are correspondingly two phases to gesture detection: Gather data about touch events.


1 Answers

onScroll event is when user touches down the screen, moves finger in some direction and lift up. It is mostly used to scroll larger layouts over a smaller viewport. onFling is the same, but made faster and usually triggers an animation that keeps scrolling few moments more after finger lifted up.

like image 191
ognian Avatar answered Jan 03 '23 14:01

ognian