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

  • Home
  • SEARCH
  • 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 3798018
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:30:14+00:00 2026-05-19T13:30:14+00:00

Even though I’m newbie with Android I’m feeling more noob than ever. I have

  • 0

Even though I’m newbie with Android I’m feeling more noob than ever.
I have my view that extends SurfaceView, and there I override the onTouchEvent and put this testing code inside:

if (event.getAction() == MotionEvent.ACTION_MOVE)
  {
   return true;
  }
  return false;

Then when I run the application in the emulator (using Eclipse) in debugging mode, there’s no way I can make it return true. I click, keep clicked and drag, and then release, but it will always be event.getAction == 0 no matter what.

What am I missing?

  • 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-05-19T13:30:15+00:00Added an answer on May 19, 2026 at 1:30 pm

    getAction() returns a combination of the actual action flag and the index of the pointer that generated that event (used for multitouch).

    To have only the action part you can do an AND with MotionEvent.ACTION_MASK:

    if (event.getAction() & MotionEvent.ACTION_MASK ==
                                   MotionEvent.ACTION_MOVE) { ...
    

    or if you’re on API >= 8 you can directly use getActionMasked(). This is useful if you have to test it in a switch.

    similar question here

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

Sidebar

Related Questions

I saw that __VIEWSTATE field gets rendered even though I have set the EnableViewState=false
In C# you can define delegates anonymously (even though they are nothing more than
I'm finding that even though I have code wrapped by Spring transactions, and it
I have noticed that even though I have a lot of doctests in our
Even though it's documented that CakePHP will automatically clear the view caches when a
I understand that even though the AudioManager.STREAM_VOICE_CALL is available in the SDK for android,
Even though I have a robust and fast computer (Pentium Dual Core 2.0 with
Even though I've been a developer for awhile I've been lucky enough to have
Even though it's not part of HTTP 1.1/RFC2616 webapps that wish to force a
One of my co-workers claims that even though the execution path is cached, there

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.