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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:20:54+00:00 2026-05-29T15:20:54+00:00

I really hope you can help me here. Below is a section of my

  • 0

I really hope you can help me here. Below is a section of my code that successfully runs two count down timers side by side…all I want to do is play a short mp3 file when count down has finished….I have tried many different bits of code but I am struggling to make anything work…an quick wins would be good..

So to round up two timers each need to play sound when finished..

//Declare Start/Stop button
Button btnstart = (Button)findViewById(R.id.btnstart);
Button Button1 = (Button)findViewById(R.id.Button01);

final TextView mCounter1TextField=(TextView)findViewById(R.id.counter1);
final TextView mCounter2TextField=(TextView)findViewById(R.id.counter2);

//Counter 1
final CountDownTimer Counter1 = new CountDownTimer(9000000 , 1000) {
public void onTick(long millisUntilFinished) {
    mCounter1TextField.setText(" " + formatTime(millisUntilFinished));
}

public void onFinish() {
    start();
}

};

//Counter 2
final CountDownTimer counter2 = new CountDownTimer(9000000 , 1000) {
public void onTick(long millisUntilFinished) {
  mCounter2TextField.setText(" " + formatTime(millisUntilFinished));

}

public void onFinish() {
  start();
}


};

//Start Button1
btnstart.setOnClickListener(new OnClickListener() {
 public void onClick(View v) {
  Counter1.start();

   }
});

//Start Button2
 Button1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
 counter2.start();

Thanks in advance

Dj

  • 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-29T15:20:55+00:00Added an answer on May 29, 2026 at 3:20 pm

    I assume start() is the function you call to play the sound, right ?

    so inside the definition of start(), put the following code :

    MediaPlayer mp = MediaPlayer.create(getBaseContext(), sound); //replace 'sound' by your music/sound
    mp.start();
    

    Hope this helps!

    Edit: trying to be super clear 🙂

    Somewhere in your code, it is written :

    public void onFinish() {
        start();
    }
    

    This method/function is called when the counter finishes.
    Inside this function it is written ‘start()’

    I don’t know what this start() does.

    In both cases, I suggest you keep it (if it doesn’t create an error), and after start(), add playSound() inside the two onFinish() methods.

    and then write OUTSIDE of this function, the following:

    public void playSound() {
    
    MediaPlayer mp = MediaPlayer.create(getBaseContext(), sound); //replace 'sound' by your    music/sound
    mp.start();
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I really hope you can help out here. I'm creating a theme for a
hope to get some help here because this is something that really makes me
I've got a massive problem and I really hope you can help me here...
I'm having a really frustrating problem I hope someone can help me with. Here
I hope someone here can help me. I know that in IE 9, there
I think I'm stuck and I really hope someone can help me out here.
I really hope someone here can help out with this. I'm using Magento 1.6.1.0
I hope somone can help me further, as I'm really much stuck here. Im
I'm almost losing it, i really hope someone can help me out! I'm using
I have a really hard time understanding routes and I hope someone can help

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.