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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:07:44+00:00 2026-06-15T07:07:44+00:00

Some Background The app that i have made, is an interval app. This allows

  • 0

Some Background

The app that i have made, is an interval app. This allows the user to choose the amount of time for each of the two intervals. When run, the app runs a countdown timer with the two user chosen time settings. I have two songs that i want to play for each interval, but i cant set the specific times when the song changes, because the user changes that. So if the user only picks 4 seconds for the first interval, I need the song to play for only that time, and when the countdown starts over with the other interval, I need the other song to play.

Now to my real question.

How do i call the audio to play? Ive looked at many questions, but they all say that i need to put the audioplayer in a new activity? If I put it in a new activity, will it not stop the countdown timer? How can i make it so that the countdown timer continues to run?

  • 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-15T07:07:45+00:00Added an answer on June 15, 2026 at 7:07 am

    You have two methods to play sounds in android, one is SoundBoard (designed for short clips, don’t use this if you want to play a song), the other one is MediaPlayer. You can play the audio by putting the file in the raw folder and then doing the following:

    MediaPlayer mp = MediaPlayer.create(ClassName.this, R.raw.sound); 
    mp.start();  
    

    Then when the timer ends you can stop the song with mp.stop(); and you can play the following audio file by doing:

    mp.reset();  
    mp = MediaPlayer.create(ClassName.this, R.raw.sound2);  
    

    When you finished remember to release the Mediaplayer with mp.release();.

    I hope I understood what you need to do, you should also put the mediaplayer inside a new thread, see this from the official android developers documentation:

    To avoid hanging your UI thread, spawn another thread to prepare the
    MediaPlayer and notify the main thread when done. However, while you
    could write the threading logic yourself, this pattern is so common
    when using MediaPlayer that the framework supplies a convenient way to
    accomplish this task by using the prepareAsync() method. This method
    starts preparing the media in the background and returns immediately.
    When the media is done preparing, the onPrepared() method of the
    MediaPlayer.OnPreparedListener, configured through
    setOnPreparedListener() is called.

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

Sidebar

Related Questions

I have an app that plays some background music, when a certain button is
I'm trying to make a Windows app that checks some things in the background,
I've been stuck on this for 3 days now. I have two pages that
I have app that uses two threads: one thread for regular application work and
Background: We have app a, b, and plan to add more apps into this
I had some problems in my app I made an app that can detect
I have an already shipped app on App Store that made use of Storyboard.
I have some png image buttons that I use in my app. But they
Background info: I have some WCF services that are hosted on an internal server
Some background I'm currently building a predominantly classic web app (rather than a single

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.