Getting error E/MediaPlayer: error (1, -19) when trying to stop and play sound again
I have muliple buttons and on clicking them I want a sound. My code goes like this button.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View view) { if(mSound != null && mSound.isPlaying()){ mSound.stop(); mSound.reset(); mSound.release(); mSound = null; } mSound = new MediaPlayer(); mSound = MediaPlayer.create(getApplicationContext(), R.raw.button); mSound.start(); } }); In OnCreate, I have intitalized mSound like this, mSound = new MediaPlayer(); mSound = MediaPlayer.create(this, R.raw.button); I am getting error (1,-19) as well as (0,38). Note: This is not
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.