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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:51:53+00:00 2026-06-05T21:51:53+00:00

In my application, I have put a button that plays its own sound by

  • 0

In my application, I have put a button that plays its own sound by picking a random button sound source from the raw directory.

But when the button is clicked, the default PHONE BUTTON SOUND plays first and then my custom button sound.

How can I disable the default phone button sound?

     public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.menu);

    //will fetch a random button sound and load it in this variable.        
    ImageButton amazingPicsButton = (ImageButton) findViewById(R.id.amazingPics);
    amazingPicsButton.getBackground().setAlpha(2);
    amazingPicsButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            startActivity(new Intent("com.jasfiddle.AmazingInterface.AMAZINGPICS"));

            //create random sound
            amazingPicsSound = createRandButSound();
            amazingPicsSound.start();
        }
    });         
}

private MediaPlayer createRandButSound(){
    return MediaPlayer.create(this, buttonSounds[r.nextInt(buttonSounds.length)]);
}
  • 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-05T21:51:56+00:00Added an answer on June 5, 2026 at 9:51 pm

    all i think you should need to do is:

    setSoundEffectsEnabled(false); 
    

    However this may be global, you may need to make your own Button class and set this.setSoundEffectsEnabled(false).

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

Sidebar

Related Questions

I installed an application from app store that uses gps. I have only put
As suggested by Apple, I have put a button on my application, to restore
I am accessing Sharepoint web services from a Silverlight application, I have put the
I have put a button over a toolbar.But when i press that button,my selector
i am new to android. in my application i have a button .i put
so I have a tab bar application where i have put a button to
In my application I have a webView that contains the FB like button. JS
I am making an application in which i have put a progress bar .
Hi i have a tab based application what i have done is put another
I have an application and I put in drawable-hdpi, drawable-ldpi and drawable-mdpi a custom

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.