Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9004523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:54:57+00:00 2026-06-16T00:54:57+00:00

Whats the problem with this code? package com.evorlor.samplecode; import android.app.Activity; public class MotionEvent extends

  • 0

Whats the problem with this 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;
    }

}

It is giving the error:

The method getAction() is undefined for the type MotionEvent
on the .getAction(). It will not let me import:

import android.view.MotionEvent;

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;):

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;
    }
}

Thanks for the help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:54:58+00:00Added an answer on June 16, 2026 at 12:54 am

    Rename your Activity to something else, it is conflicting with the actual MotionEvent Class it needs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code below: package com.example.killall; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import
package com.parseador.prueba; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; public class main extends
I have the following code: package com.example.top_tech_deals; import android.app.Activity; import android.content.Intent; import android.media.MediaPlayer; import
This is a very weird problem. I'll just post the code directly: package com.asim.contactspull;
Here's my code: package com.eggproject_hu.WPECommerceAdminSales.client; import java.lang.Boolean; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.Window; public class AblakVillogo
This is my first android app. I am posting the code I am using
We used the class JAXWSProperties from the com.sun.* package in the code in order
I am using the following code for 2D-QR code decoder. package com.test.rim; import java.util.*;
What is the problem with this code? How to solve it? Parent processes goto
i'm getting dialogue box (Operation aborted) What is the problem in this code? <script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.