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 6177885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:21:16+00:00 2026-05-24T00:21:16+00:00

So, I’m developing an app and need to have two buttons pressed at the

  • 0

So, I’m developing an app and need to have two buttons pressed at the same time.
I need the events for the buttons to be triggered when pressed(which is at the same time, too).

Imagine a car – I have left, right, forward and back. I need to press EG. forward and right together to make a right turn.

Here is my method but for some reason when I press both buttons, only the one pressed first is triggered… Any ideas?

    // Handle touches of the navigation arrows
    public boolean onTouch(View v, MotionEvent theMotion) {
        switch (theMotion.getAction()) {
        // A button was PRESSED
        case MotionEvent.ACTION_DOWN:
            switch (v.getId()) { // Which button?
            case R.id.freestyle_upArrow: // The upArrow
                bt.sendNXTcommand(MOTOR_B_FORWARD, 720);
                break;
            case R.id.freestyle_downArrow: // The downArrow
                bt.sendNXTcommand(MOTOR_B_BACKWARD, 720);
                break;
            case R.id.freestyle_leftArrow: // The leftArrow
                bt.sendNXTcommand(MOTOR_A_LEFT, 720);
                break;
            case R.id.freestyle_rightArrow: // The rightArrow
                bt.sendNXTcommand(MOTOR_A_RIGHT, 720);
                break;
            }
            break;
        // A button was RELEASED
        case MotionEvent.ACTION_UP:
            switch (v.getId()) { // Which button?
            case R.id.freestyle_upArrow: // The upArrow
                bt.sendNXTcommand(MOTOR_B_STOP, 0);
                break;
            case R.id.freestyle_downArrow: // The downArrow
                bt.sendNXTcommand(MOTOR_B_STOP, 0);
                break;
            case R.id.freestyle_leftArrow: // The leftArrow
                break;
            case R.id.freestyle_rightArrow: // The rightArrow
                break;
            }
            break;
        }
        return true;
    }

So, any have any ideas? Does it have something to do with the number of points allowed on my screen?

PHONE SPECS: Samsung Galaxy Ace running Android OS on firmware 2.2.1

Regards,

Rich.

  • 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-24T00:21:17+00:00Added an answer on May 24, 2026 at 12:21 am

    Using

    switch (event.getAction() & MotionEvent.ACTION_MASK)
    

    You want to look for

    MotionEvent.ACTION_POINTER_UP
    MotionEvent.ACTION_POINTER_DOWN
    

    For the second finger. Keep in mind you will get a ACTION_POINTER_UP no matter which finger is lifted first

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

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.