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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:48:33+00:00 2026-06-09T10:48:33+00:00

I am developing an Android App that plays some sounds. For that I am

  • 0

I am developing an Android App that plays some sounds. For that I am creating an object of MediaPlayer. Below is the code:

mp = MediaPlayer.create(this, R.raw.testSound);

Here mp is null for Android 2.3.3 (API Level 10), i tried with other versions of Android (2.1, 2.2 etc.) it works fine. However with Android 2.3.3 (API Level 10) MediaPlayer.create() call returns null.

The sound file (testSound.wav) is a wav file. I tried parsing the wav file to see if it is corrupted or not. It seems just fine.
Also, I could play this sound file using Windows Media Player.

Here’s the testSound.wav file: testSound.wav and below is the code in detail:

public MediaPlayer mp;

// OnCreate() funciton
mp = MediaPlayer.create(this, R.raw.testSound);
if(mp == null)   // mp is null for Android 2.3.3 on real device and on AVD both
  {
  Toast msg = Toast.makeText(getApplicationContext(), "Could not play sound",         
  Toast.LENGTH_LONG);
  msg.show();
  }

//SetMediaFileToPlay() is called on Click event of button
void SetMediaFileToPlay() 
{       
    AssetFileDescriptor afd;     
    Resources res = getResources();
    Log.d("In SetMediaFileToPlay %s", g_strFocusedImage.toString());
    switch (g_strFocusedImage)
    {
      case RESID_ALPHA1:
      afd = res.openRawResourceFd(R.raw.ik);
      if(mp != null)
      {
        mp.reset();
        mp.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(),      
        afd.getLength());
      }  
      break;
      .........  //other cases
   }

 if(mp != null)
  {
    mp.prepare();
    mp.start();
  }

}

Please help. Thank You.

  • 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-09T10:48:34+00:00Added an answer on June 9, 2026 at 10:48 am

    Your file uses WAVE 8,000Hz MP3 8 kbit/s format, while android supports only 8- and 16-bit linear PCM: http://developer.android.com/guide/appendix/media-formats.html.

    Try fixing your file.

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

Sidebar

Related Questions

The scenario is, i'm developing an android app that uses the internet. This is
I am developing one android app in that i have to post some message
I am developing an Android App that gets some data from a web server,
I'm developing an Android app that will play a specific audio. This audio is
I'm developing an Android app that receives the ougoing call event and extract the
I started developing an android app that have to interact with MMS attachements, in
I'm developing an Android app that uses Osmdroid to display the maps in offline
I have a 2.3.3 android app that I am developing that I would like
I am developing an Android app and want to share some text by opening
I am developing an Android app that connects to the Facebook Open Graph via

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.