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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:58:59+00:00 2026-06-17T15:58:59+00:00

Im coding a little Android-App at the moment and discovered a strange issue regarding

  • 0

Im coding a little Android-App at the moment and discovered a strange issue regarding multiple Buttons. I have an Activity with 4 Buttons on it. When I press multiple Buttons at once, both actions are executed. So I can press all 4 Buttons and all 4 following Activities are started.

This is my onButtonClick-Method

public void onButtonClick(View view) {
    Intent intent = new Intent(this, RunActivityConfirm.class);

    switch(view.getId()) {
        case R.id.btnRunAcceleration:
            intent.putExtra("DisciplineName", "Acceleration");
            startActivity(intent);
            break;
        case R.id.btnRunSkidPad:
            intent.putExtra("DisciplineName", "Skid Pad");
            startActivity(intent);
            break;
        case R.id.btnRunAutocross:
            intent.putExtra("DisciplineName", "Autocross");
            startActivity(intent);
            break;
        case R.id.btnRunEndurance:
            intent.putExtra("DisciplineName", "Endurance");
            startActivity(intent);
            break;
    }

}

First I thought the problem ist that I always call startActivity() in every single “case” but even if I try the following all 4 Activities get started at the same time

public void onButtonClick(View view){   
    Intent intent = new Intent(this, RunActivityConfirm.class);

    switch(view.getId()) {
        case R.id.btnRunAcceleration:
            intent.putExtra("DisciplineName", "Acceleration");
            break;
        case R.id.btnRunSkidPad:
            intent.putExtra("DisciplineName", "Skid Pad");
            break;
        case R.id.btnRunAutocross:
            intent.putExtra("DisciplineName", "Autocross");
            break;
        case R.id.btnRunEndurance:
            intent.putExtra("DisciplineName", "Endurance");
            break;
    }
    startActivity(intent);
}

This happens all over my App. No matter which Button I press every associated Action is executed and every associated Activity is started.

Is there anything I can do about it?

  • 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-17T15:58:59+00:00Added an answer on June 17, 2026 at 3:58 pm

    When I press multiple Buttons at once, both actions are executed.

    This is expected behavior. Your code starts an activity when a button is pressed. Multiple buttons are pressed, so multiple activities are started.

    If you want to change this so that only one button can be pressed, then you need to add code to do so. You could disable the other buttons in onButtonClick (and re-enable them when appropriate).

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

Sidebar

Related Questions

I do mostly google app engine coding, and a little bit of android development,
I've built an app 100% in IB without coding. I have little coding background,
Started coding up a simple android app. Part of it pulls the users last
while coding a little iPhone App with a friend, we decided to use Subversion
Hi, I have been coding a little Js function that manipulates certains divs and
So, I've been coding for a little (2 years), and I have a very
So I'm still working on my first little app here, new to Android and
Hi i have been working through my first android app and it's starting to
I'm fairly new to Java & Android, so I have little idea what I
Im a newbie at android coding and I looked around a little to try

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.