title: Motion Event for the Android
body: <p>Whats the problem with this code?</p>
  
  <pre><code>package com.evorlor.samplecode;
  
  import android.app.Activity;
  
  public class MotionEvent extends Activity {
  
      public boolean onTouchEvent(MotionEvent me) {
          int i = me.getAction();
  
          switch (i) {
  
          case MotionEvent.ACTION_DOWN:
              // When your finger touches the screen
  
              break;
  
          case MotionEvent.ACTION_UP:
              // When your finger stop touching the screen
  
              break;
  
          case MotionEvent.ACTION_MOVE:
              // When your finger moves around the screen
  
              break;
          }
  
          return false;
      }
  
  }
  </code></pre>
  
  <p>It is giving the error:</p>
  
  <p>The method getAction() is undefined for the type MotionEvent
  on the .getAction().  It will not let me import:</p>
  
  <pre><code>import android.view.MotionEvent;
  </code></pre>
  
  <p>As far as I can tell, it is the same as this working code (aside from it not letting me import the import android.view.MotionEvent;):</p>
  
  <pre><code>package com.evorlor.counter;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.Gravity;
  import android.view.MotionEvent;
  import android.view.View;
  import android.widget.TextView;
  
  public class Counter extends Activity {
  
      private static int count = 0;
      private static int hiCount = 0;
      private static boolean capCount = false;
      public static boolean resetCount = false;
      public static boolean askReset = false;
  
      public boolean onTouchEvent(MotionEvent me) {
          if (me.getAction() == MotionEvent.ACTION_UP) {
              count++;
          }
  
          onCreate(null);
  
          return false;
      }
  }
  </code></pre>
  
  <p>Thanks for the help!</p>