Painless Android swipe detection

how-to
Apr 7, 20131 min

Why bother building navigation buttons in an Android app when you can easily capture finger swipes? But, if you’ve ever implemented gesture section in Android there’s the drudgery of implementing listeners and you also need to do some elementary Cartesian math. Save yourself the boilerplate bother mathematics and use a library!

Gesticulate makes it painless to detect straightforward swiping motions like up, down, left, and right. It’s a simple jar file you include in your Android libs directory. Throw Gesticulate’s SwipeDetector inside an instance of Android’s SimpleOnGestureListener, for example, and you’re detecting swipes with ease!

Gesticulate is used in Savvy Words, a flash card vocabulary app found on Google Play and Amazon’s Appstore for Android. See the Github project for more details such as code examples for how to use Gesticulate, how to build it, and to see Gesticulate’s tests. Swipe on, baby!

andrew_glover

When Andrew Glover isn't listening to “Funkytown” or “Le Freak” he enjoys speaking on the No Fluff Just Stuff Tour. He also writes articles for multiple online publications including IBM's developerWorks and O'Reilly’s ONJava and ONLamp portals. Andrew is also the co-author of Java Testing Patterns, which was published by Wiley in September 2004; Addison-Wesley’s Continuous Integration; and Manning’s Groovy in Action.

More from this author