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

The Archive Base Latest Questions

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

sorry for my bad english .. probably you’ll see some grammar errors.. I’m learning

  • 0

sorry for my bad english.. probably you’ll see some grammar errors..

I’m learning to program an android application and I need help.
I would like to put some mp3 files in ‘res/raw‘ folder and i would like to put specific text on each item on the Listview. So when the user clicks on the item he wants (for example a song title), the associated mp3 starts.

I would like if you can teach me how to play just one mp3 at time (beacause the user could clicks many items during the first mp3 playing).
I’m new in the android world so please be patient and use simple terms 🙂

Have a nice day,
Riccardo.

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

    As your question does not include any specific code of yours I can give you a few guidelines.

    1. Declare a class member reference to the MediaPlayer instance. e.g. it should be declared in the class’s scope, and not in any method within it:

      public class MyListView extends ListView {
          private MediaPlayer mp = null;
          //your methods here
      }
      
    2. In your OnClickListener, check if the instance is null, and if not, stop and release it, and create a new instance with the new song.

      public void onClick(View v) {
          if (mp != null) {
              mp.stop();
              mp.release();
              mp = MediaPlayer.Create(....);
              mp.start();
          }
      }
      
    3. If instead of create you decide to use prepareAsync(), make sure that you don’t call start right after preparation, but instead assign a OnPreparedListener and call start in it.

    Except of that, follow the guidelines in the MediaPlayer reference.

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

Sidebar

Related Questions

first,sorry for my bad English!! i'm new here and i'm a beginner of android
First. Sorry for bad english. I want to make some common transformation of Map
Sorry for my bad English. I'm from Germany and have some problems with parsing
Sorry for bad English :( Suppose i can preliminary organize recipes and ingredients data
Hello (Sorry for my bad English) Is it bad practice to assign object to
Sorry for bad english. bfproduct is a table and productid is primary key in
(sorry for my bad english) In a Silverlight 4 + RIA Services + EF4
First, sorry for bad english :-) On a little website i own, i would
Sorry for my bad English... Using Delphi 7 I want to create a dialog
Sorry for my bad English. I have one TextView and it have a Background

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.