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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:30:49+00:00 2026-06-11T05:30:49+00:00

I am playing some wav file and after while i want to stop it.

  • 0

I am playing some wav file and after while i want to stop it.

I am using singleton like

private static playSound instance = null;

public static synchronized playSound getInstance(Context context) {
    if(null == instance) {
        instance = new playSound(context, "", 1);
    }

    return instance;
}

and i am calling

public void stopAudio() {
    try{
        myplayer.stop();
        myplayer.release();         
    } catch(Exception e){
        Log.e(TAG, "Exception caught:\n" + e.getMessage() +"\n" + e.getStackTrace());               
    }
}

instance is not null so i think this should work because is the same instance…

but i get:

MediaPlayer: stop called in state 1
  • 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-11T05:30:50+00:00Added an answer on June 11, 2026 at 5:30 am

    You need to check first is it playing or not ?? If it is playing your stop method should work.

    E.g :

    if (   media_player             != null
        && media_player.isPlaying() == true) {
        try {
            media_player.stop();
            media_player.release()
        } catch (Exception e) {
        }
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written some code for playing a .wav through my application. Now I
Been doing some playing call my service which is on a different domain using
I need some classes for playing short wav sounds, this classes would load this
I am designing a web page for playing some movies. I want user to
I'm using AVAudioPlayer for playing some caf files on an app, it is working
i'm building an iphone application that base on playing some audio file. all thing
I have some playing cards that flip over when you tap them. I want
I've been playing with some algorithms on the internet for a while and I
I have some Windows Phone 7 code that starts playing a sound using SoundEffect.FromStream.
I have a VideoDisplay instance playing some video. When I click on the video

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.