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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:10:17+00:00 2026-05-17T23:10:17+00:00

How do I go about getting my app to play an mp3 (in my

  • 0

How do I go about getting my app to play an mp3 (in my res) on startup? Or how how about if I wanted this to happen when a button is clicked?

  • 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-17T23:10:18+00:00Added an answer on May 17, 2026 at 11:10 pm

    From the Audio and Video section of the Dev Guide:

    Perhaps the most common thing to want
    to do is play back media (notably
    sound) within your own applications.
    Doing this is easy:

    1. Put the sound (or other media resource) file into the res/raw folder of your project,
      where the Eclipse plugin (or aapt) will find it and make it into a resource that can be
      referenced from your R class

    2. Create an instance of MediaPlayer, referencing that resource using MediaPlayer.create, > and then call start() on the instance:

    MediaPlayer mp = MediaPlayer.create(context, R.raw.sound_file_1);
    mp.start();
    

    To stop playback, call stop(). If you
    wish to later replay the media, then
    you must reset() and prepare() the
    MediaPlayer object before calling
    start() again. (create() calls
    prepare() the first time.)

    To pause playback, call pause().
    Resume playback from where you paused
    with start().

    So put the above code example in the onCreate() or onStart() of your launcher activity to have it play on startup, and place it in a button’s onClick() method to respond to a button press.

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

Sidebar

Related Questions

How exactly would one go about getting an OpenGL app to run fullscreen straight
This is more of a question about getting my head around the process I
I have seen this question that talks about getting the last part of a
I posted another question earlier about getting the arguments from a context menu App.
My app is getting about 1000 spam entries a day. The content is not
How would i go about getting the value of a field in another language
My last question was about getting the string representation of an object serialized to
I'm just about getting into WCF ; but from what I've read so far,
I have a question about getting DLL's directory on Windows system. The situation is
An earlier question was answered about getting the OrderID and the number of associated

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.