title: How to implement double tap for Android live wallpapers?
body: <p>I want to implement a double tap event for a Android live wallpaper.
  Sadly, I couldn´t find any specific code how to do that.</p>
  
  <p>At the moment I´ve found a workarround using the onTouchEvent-method of the Engine-class:</p>
  
  <pre><code>public void onTouchEvent(MotionEvent event) {
    long time = android.os.SystemClock.currentThreadTimeMillis();
  
    if(((time - mLastTouchTime) &lt; 500) &amp;&amp; ((time - mLastTouchTime) &gt; 100))
    {
      if(!mIsPlayed &amp;&amp; mSound)
        {
          mIsPlayed = true;
          int sound = R.raw.hell;
          if(mTheme.equals("rose"))
            sound = R.raw.rose;
          if(mTheme.equals("greed"))
            sound = R.raw.greed;
  
          MediaPlayer mp = MediaPlayer.create(getBaseContext(), sound);   
            mp.start();
            mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
        @Override
        public void onCompletion(MediaPlayer mp) {
          // TODO Auto-generated method stub
          mp.release();
          mIsPlayed = false;
        }
      });
        }
    }
  
    mLastTouchTime = time;
    super.onTouchEvent(event);
  }
  </code></pre>
  
  <p>Well, that´s not an elegant solution. I know there are wallpapers which implemented the double tap. But I have no idea, how to do it on my own.</p>
  
  <p>So a "tap" in the right direction would be nice. If nescessary, I will accept a "double tap". :D</p>
  
  <p>Greetings,
  Robert</p>