Android Question Detect when touch or scroll ends

apty

Active Member
Licensed User
Longtime User
I would like to know how i can detect when a user has stopped touching the screen or scrolling through it.
e.g. If a user scrolls from left to right of the screen,once he stops i would like to display a message. Is this possible? please help
 
Are you wanting to do this in a particular view (eg: a scrollview), or do you want to detect it at the activity level? I haven't tried this myself, but I imagine you would want to implement a gesture recognizer. If you search the forums for gesture recognizer, you should find some info...

- Colin.
 
Upvote 0
Are you using a loop like shown in that thread? If so, you need to add a Sleep so the UI can continue to update:

Code: Copy
Do While [whatever]
    Sleep(0)
Loop

- Colin.
 
Upvote 0
Use a timer. Enable it and record current ticks when scrolling starts. Each further scroll record current ticks. Detect that scrolling has stopped in the timer tick event by testing to see if ticks were updated since the last timer event
 
Upvote 0
After adding sleep, the delay function is no longer working
As Misterbates says, if you want to have a delay that also allows the UI to continue updating you'll have to use a timer (or something other than a loop). If you post the code you have, it might be easier to point you in the right direction (if a timer isn't going to do it for you).

- Colin.
 
Upvote 0
Back
Top