O'Reilly logo

Xamarin Mobile Development for Android Cookbook by Matthew Leibowitz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Responding to custom user gestures

There are other types of gestures that the user can perform, such as drawing letters or other shapes. These gestures may be more complex than a twist or drag, so we cannot just rely on simple finger tracking, but rather we need shape recognition.

How to do it...

We can store, recognize, and visualize shape gestures using a GestureLibrary instance:

  1. We access a particular GestureLibrary by requesting one through the GestureLibraries type:
    GestureLibrary library = GestureLibraries.FromPrivateFile(this, "gestures");
  2. When we want to load the gestures, or refresh the library, we invoke the Load() method:
    library.Load();
  3. Then, we can list all the gestures in the library using the GestureEntries property:
    string[] entries = ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required