<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Apps on Micha Kops&#39; Tech Notes</title>
    <link>https://www.hascode.com/tags/apps/</link>
    <description>Recent content in Apps on Micha Kops&#39; Tech Notes</description>
    <generator>Hugo -- 0.147.8</generator>
    <language>en</language>
    <copyright>Copyright © 2010 - 2025 Micha Kops. #213243b1d6e8932079e09227d3f3ed0c806cd0c9</copyright>
    <lastBuildDate>Fri, 21 May 2010 00:00:00 +0200</lastBuildDate>
    <atom:link href="https://www.hascode.com/tags/apps/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Android Gestures</title>
      <link>https://www.hascode.com/android-gestures/</link>
      <pubDate>Fri, 21 May 2010 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/android-gestures/</guid>
      <description>&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Since version 1.6 Android offers a library for recognition and handling of new gestures using a touch display. With the gesture builder it is possible to capture new gestures in the emulator. Gestures can be integrated into an activity like that.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;GestureLibrary gLib = GestureLibraries.fromRawResource(this, R.raw.spells);
if (!gLib.load()) {
  finish();
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;ulist&#34;&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Furthermore we need a gesture overlay in the UI:&lt;/p&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt; &amp;lt;android.gesture.GestureOverlayView
    android:id=&amp;#34;@+id/gestures&amp;#34;
    android:layout_width=&amp;#34;fill_parent&amp;#34;
    android:layout_height=&amp;#34;0dip&amp;#34;
    android:layout_weight=&amp;#34;1.0&amp;#34; /&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the next step we implement an event handler for the gesture (Source: &lt;a href=&#34;http://developer.android.com/resources/articles/gestures.html&#34; class=&#34;bare&#34;&gt;http://developer.android.com/resources/articles/gestures.html&lt;/a&gt;):&lt;/p&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;GestureOverlayView gestures = (GestureOverlayView) findViewById(R.id.gestures);
gestures.addOnGesturePerformedListener(this);

public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
 ArrayList&amp;lt;prediction&amp;gt; predictions = mLibrary.recognize(gesture);

   if (predictions.size() &amp;gt; 0) {
     Prediction prediction = predictions.get(0);
     if (prediction.score &amp;gt; 1.0) {
       Toast.makeText(this, prediction.name, Toast.LENGTH_SHORT).show();
     }
   }
 }&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</description>
    </item>
  </channel>
</rss>
