Wednesday 15 April 2015

android - stop media player mp3 when back button pushed -


OK, I'm on the 4th of the day for my work answer. I hope the stack can help

when you press the back button, my code works fine, the MP3 file called "test", when I press the stop button and audio check When the screen goes back to my menu screen then plays. Exactly ... By the time I do not test the code on my phone, all works great when I quit using my phone's back button on my Android phone (my app's stop button) plays media player lives. I tried all the code and saw every appropriate question. I implemented the code, but the ending keyweat KKOD_back and so forth, nothing works, I'm stumped.

Please help. Here is my code

  expanding the public class Audio_Check activity (/ non-Javadoc) * @see android.app.Activity # onCreate Pressing the Android back button How can I stop this MP3 ? (Android.os.bundle) * / import android.app.activity; Import android.content.Intent; Import android Media. media Player; Importroid.os.Bundle; Import android.view.KeyEvent; Import android.view.View; Import android.widget.Button; Enhances public-class audio-heavy activity {@ Override Protected Zero (Bundle Saved Instantstate) {// Todo Auto-Generated Method Stub Super. Connet (Saved Instantstate); SetContentView (R.layout.audio_check); Final Media Player Buttons = Media PlayerCredit (AudioCheck.This, ROAS.Testing); Button Stubton = (Button) Find VBID (RID. Startbutton); Stbutton.setOnClickListener (New View.OnClickListener () {@Override Public Zero Click on (see V) {// TODO automatically generated method stub button Sundance. Start ();}}); Button Sputton = (button) Find VVBIID (RID steppen); Spbutton.setOnClickListener (see new OnClickListener) {@Override Public Zero Click on (see V) {// TODO Auto generated method Stub Buttons (.stop); ButtonSound.Relge (); Intention openE1 = new intent ("com Myapp.mysite.MENU"); StartActivity (openE1);}}); }   

}

keep this method, @Override Safe voidDestroy () {super.onDestroy (); ButtonSound.stop (); ButtonSound.reset (); ButtonSound.release (); ButtonSound = Faucet; }

Hope this will work.

No comments:

Post a Comment