views:

96

answers:

2

Hello, I am developing an android application.and ...i am novice in Touch enabled Android Application..

I have read the article about "onFling" and "onScroll" event on:

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


But i didnt get exactly what is the meaning and for what we can use OnFling and onScroll event ??

if anybody know then help me......

+2  A: 

Hi,

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.

ognian
thanx for the answer....really it helped me a lot in my current application....
PM - Paresh Mayani
I'm glad about it
ognian
actually i want to implement this kind of events on Image Scroll..means i want to Scroll image in particular direction with the event of Scrolling by touching on screen..so should i use onScroll or onFling event for that ?
PM - Paresh Mayani
You don't use these methods, Android call them for you when the corresponding event occurs. To handle scrolling, you must write implementation for onScroll, and onFling is optional if you want to give richer experience experience when scrolling large surfaces.
ognian
@Ognian...thanx for replying..your reply found really helpful... pls let me know about "Spinning an image(portrait) in left and right direction...which event should i implement..? pls pls helpLet me describe in detail...I'm trying to figure out the best way to make an image "spin" along with a user's finger dragging it left or right. I want to try and match the rate a user's finger is moving with the rate the image is spinning...so what way i can do ?? if you have any idea then pls help me..
PM - Paresh Mayani
@Paresh The easiest way is to wrap your ImageView into HorizontalScrollView, it'll take care of scrolling in a very descent way. Implementing scrolling by yourself would be an overkill
ognian
@Ognian Consider that there are 40 images with different angles..so at initial stage....image point is at 20th..if user moves their finger in left direction then images should be displyed from 20 to 0..and if in right direction..it should be from 20 to 40..so imageview inside HorizontalScrollView is the solution for it ?
PM - Paresh Mayani
A: 

@Paresh Maybe you can go for a viewflipper, that'd solve your problems

Gooner