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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:07:00+00:00 2026-05-24T18:07:00+00:00

I have following code to play small audio files private void playVoice() { if

  • 0

I have following code to play small audio files

private void playVoice() {

     if (mPlayVoice != null) {
         if (mPlayVoice.isPlaying()) {
             mPlayVoice.release();
             mPlayVoice = null;
         }
     }
     mPlayVoice = 
         MediaPlayer.create(BirdsActivity.this, mSoundIds[getCurrentIndex()]);
     mPlayVoice.start();
 }

It works fine in Samsung galaxy tab but gives below error in small device(I Checked in Sony xperia mini pro my project)

08-17 12:45:45.232: ERROR/AndroidRuntime(6639): java.lang.IllegalStateException
    08-17 12:45:45.232: ERROR/AndroidRuntime(6639):     at   android.media.MediaPlayer.isPlaying(Native Method)
    08-17 12:45:45.232: ERROR/AndroidRuntime(6639):     at           com.android.mds.kidsapps.alphakids.BirdsActivity.playVoice(BirdsActivity.java:146)
  • 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-24T18:07:01+00:00Added an answer on May 24, 2026 at 6:07 pm

    You’re doing this:

     PlayVoice.release(); 
    

    Do you not mean

     mPlayVoice.release(); 
    

    If you have other issues this is the best document to consult:

    Android MediaPlayer

    EDIT

    Ok if you are here: isPlaying() Invalid States it show’s you’re trying to call isPlaying() while the player is in the error state. So you need to work out why it is already in the error state.

    In general, some playback control operation may fail due to various reasons, such as unsupported audio/video format, poorly interleaved audio/video, resolution too high, streaming timeout, and the like.

    Have a look at adding an error listener: setOnErrorListener()

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

Sidebar

Related Questions

I use the following code to record audio files and play. I have a
I have the following code- private void button1_Click(object sender, EventArgs e) { _soundplayer.Play(); timer1_Tick();
I have the following code: public void Dispose() { if (_instance != null) {
I am using the following code to play audio file. I have tested the
I have the following code for Android which works fine to play a sound
I have the following code i am trying to get the play speed rank
I have the following code: AssetFileDescriptor afd = getAssets().openFd(AudioFile.mp3); player = new MediaPlayer(); player.setDataSource(afd.getFileDescriptor());
I have the following piece of code which play the flv file, <embed align=middle
I have some FLVs which I'd like to play. The following code works fine
I have the following code: string Keys = string.Join(,,FormValues.AllKeys); I was trying to play

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.