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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:44:48+00:00 2026-05-26T01:44:48+00:00

I simply have a sound that executes on a button click. Everything works fine

  • 0

I simply have a sound that executes on a button click. Everything works fine in the emulator but sound #2 plays in an infinite loop when I run on my phone.

Could this be a phone issue I have downloaded other apps from the market that have had these weird sound loops. (I have a Droid 2)

Declarations:

final MediaPlayer mp1 = MediaPlayer.create(this, R.raw.sound1);
final MediaPlayer mp2 = MediaPlayer.create(this, R.raw.sound2);

Button 1 code is as follows.

button1.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {                       
                    mp1.start();
                    textView1.setText("Hello");
                  }
            });

Button 2 code is as follows.(This is the loopy one)

    button2.setOnClickListener(new OnClickListener() {      
        public void onClick(View v) {
            count++;      
            mp2.start();                
            iv1.setVisibility(View.VISIBLE);                                    
            if (count == 5) {                 
                //I do some enabling of components in here      
            }                   
        }         
    });

I have tried

.stop()
.setLooping()
.pause()

as well as moving .start() after and before the if statement
All of these result in it still looping or no sound at all.

  • 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-26T01:44:48+00:00Added an answer on May 26, 2026 at 1:44 am

    If you swap R.raw.sound1 with R.raw.sound2 does the looping problem stay with the 2nd media player or does it follow sound2?

    I’m not an expert on the format of sound files, but it could be a problem with the file itself. Try opening the file in Audacity and cutting off the last 10 ms then save it as something new and see if the problem exists in the new file.

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

Sidebar

Related Questions

I'm trying to make a HTML5 webapp that simply plays a sound over and
So my task may sound simple, but it has me boggled. I have looked
I have a very simply subclass of UIButton that will fire off a custom
I have a bash script that simply calls different calls and redirect stdout and
I have an app which plays a few short sound clips. To play them
I simply have 2 tabs and used Experience - Multiple Android Activities in a
I simply have 2 tabs and used Experience - Multiple Android Activities in a
First of all, excuse my poor topic title. I simply have no idea how
What are the technical questions I simply must have answers for before I approach
I have a @variabletable simply defined as EOMDate(datetime), DandA(float), Coupon(float), EarnedIncome(float) 04/30/2008, 20187.5,17812.5,NULL 05/31/2008,

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.