2

I'm trying to code a stopwatch which resets itself when you swipe right on the touchscreen. I've had a look round here and on Google, and I can't find anything which explains how this would be done in very simplistic terms - I think it would be some kind of gesture detector, but none of the explanations have been particularly clear on how I would implement this.

Any help would be much appreciated!

CuriousCabbage
  • 414
  • 1
  • 5
  • 10
  • `on the touchscreen`!! which screen? the `Home Screen` or `your app screen`? – Mohammad Ersan Mar 09 '13 at 21:26
  • The app screen, I would imagine. – CuriousCabbage Mar 09 '13 at 21:27
  • Generally speaking you need to implement a GestureDetector and in the onSwipe() method call your reset method, using the parameters given by onSwype to check the direction of swype. I think that's right, could be something completely different though, I just said what I remember from the one time I had to detect sypw. – Rodrigo Castro Mar 09 '13 at 21:27
  • That's precisely the problem - what is a GestureDetector? How do I implement it? What is the "onSwipe()" method? – CuriousCabbage Mar 09 '13 at 21:29
  • Subclass [GestureDetector.SimpleOnGestureListener](http://developer.android.com/reference/android/view/GestureDetector.SimpleOnGestureListener.html) and override `onFling()` to detect the swipe. See http://stackoverflow.com/questions/937313/android-basic-gesture-detection – quietmint Mar 09 '13 at 21:32

0 Answers0