Can you explain how onResume() works with MediaPlayer? What am I supposed to put inside the function so that when I resume from a different activity, the music plays again?
I did what you did and it works and it runs perfectly. Except when I run it on the emulator, I get no sound. After checking my code I was skeptical and ran the application on my android phone. The sound played but it still would not play on the computer.
Yes I have speakers and I can play the sound file individually on the computer but it will not play in the emulator. What's going on here?
@letccc whats up man, onPause() gets called anytime that specific activity goes to the background (android handles this for us) So if you have two activities act1 and act2. if act1 opens up act2, act1 will call the onPause method after act2 is present. Also anytime someone gets a phonecall, hits the back button, or the home button on their phone the onPause method gets called as well.
@mybringback well I have the same problem as @DiMAGiNEfilms. Maybe I have to big file? Its 2 mb. Format:mp4. (maybe the soong needs to be 5 sec long to not crash? And, is there a way to keep the music going to the next screen/on every screen I go in to + if i wana go back one screen aaand repeat from the beginning when song ends? Great vids keep em up^^
If you are getting a Force Close you probably didn't delete "MediaPlayer" when you added a second instance. Rewatch the video from 5:00-6:00 especially 5:50-5:54
OS X has built in conversion... if you right click on the file and select Get Info, you can change the extension there and it should automatically convert the file
ok, I figured it out I had the logoMusic below the Thread, my new question is after the 5 seconds pass it comes up with a message saying it has to close unexpectedly
i am a c#.net developer. but your tutorial helps me to learn the java in different way. and now my interest has started to focus on the Android development. so hope fully when i finish ur tutorial i should be able to come up with a product. thanks for the help that you do.
how is your design called o.o
TiyDima 5 days ago
Comment removed
TheSything 6 days ago
These videos have been ridiculously helpful. Thanks for taking the time to put them together!
febvigrail 6 days ago
This has been flagged as spam show
A more efficient way for the onPause() would be:
if(logoMusic.isPlaying()){ logoMusic.release(); }
lt99range 1 week ago in playlist mybringback android tutorial
Comment removed
lt99range 1 week ago in playlist mybringback android tutorial
Comment removed
lt99range 1 week ago in playlist mybringback android tutorial
For those of you who are getting crashed make sure you remove "MediaPlayer" from this line
MediaPlayer logoMusic = MediaPlayer.create(myMain.this, R.raw.logosound);
That's line 17 on my screen. We ended up stating logoMusic is a mediaplayer near the top making it global.
McClover 1 week ago
Can you explain how onResume() works with MediaPlayer? What am I supposed to put inside the function so that when I resume from a different activity, the music plays again?
iamarnold900 2 weeks ago
Greetings Master! I'm stuck with this 'force closing' error after adding the onPause(). Without it, everything is OK! Thanx !!!
SerLeBat 2 weeks ago
my app keeps force colising hellllllop
talhah321 1 month ago
when i type main it comes up with error in java activity help plz
talhah321 1 month ago
I did what you did and it works and it runs perfectly. Except when I run it on the emulator, I get no sound. After checking my code I was skeptical and ran the application on my android phone. The sound played but it still would not play on the computer.
Yes I have speakers and I can play the sound file individually on the computer but it will not play in the emulator. What's going on here?
jacobbubble2 1 month ago in playlist Android Development For Absolute Beginners
kindly explain anyone.. i am assuming that onCreate() is executing when app will start ... but when protected onPause() will execute itself..?
i have seen traviz didnt call onPause() .. but app is running fine..
anyone?
letccc 1 month ago
@letccc whats up man, onPause() gets called anytime that specific activity goes to the background (android handles this for us) So if you have two activities act1 and act2. if act1 opens up act2, act1 will call the onPause method after act2 is present. Also anytime someone gets a phonecall, hits the back button, or the home button on their phone the onPause method gets called as well.
mybringback 1 month ago
Hey! My app crashes after the Splash screen. It started doing this after I added sound :(
DiMAGiNEfilms 2 months ago
@DiMAGiNEfilms still having problems with this? let me know
mybringback 1 month ago
@mybringback well I have the same problem as @DiMAGiNEfilms. Maybe I have to big file? Its 2 mb. Format:mp4. (maybe the soong needs to be 5 sec long to not crash? And, is there a way to keep the music going to the next screen/on every screen I go in to + if i wana go back one screen aaand repeat from the beginning when song ends? Great vids keep em up^^
SuperLPGaming 1 month ago in playlist Android Development For Absolute Beginners
This has been flagged as spam show
If you are getting a Force Close you probably didn't delete "MediaPlayer" when you added a second instance. Rewatch the video from 5:00-6:00 especially 5:50-5:54
faithlocket 2 months ago in playlist Android Development For Absolute Beginners
Comment removed
faithlocket 2 months ago in playlist Android Development For Absolute Beginners
OS X has built in conversion... if you right click on the file and select Get Info, you can change the extension there and it should automatically convert the file
Nice Tutorial As Well!
ProgrammersWeb 2 months ago in playlist Android Development For Absolute Beginners
thank u so much travis
i had a small problem
when i want to run the application an error message appears in the emulator screen says that there is unexpected error and i have to force close it
what is wrong with it !!!! and i really did everything as what u did exactly step by step
AHXAL 2 months ago
Ur GREAT!
dar1e 4 months ago
Everything seems to be the same on my code as yours, but I keep getting the message "raw cannot be resolved or is not a field"
Any ideas what might be wrong?
SkinnyMetalDude 5 months ago
Nevermind this post. I went to Project -> Clean... and this helped whatever may have gone wrong. Great tutorials! I hope you keep adding more!
SkinnyMetalDude 5 months ago
@SkinnyMetalDude com.yourdomain.appname.R.raw.musicfile
try this..
letccc 1 month ago
ok, I figured it out I had the logoMusic below the Thread, my new question is after the 5 seconds pass it comes up with a message saying it has to close unexpectedly
i was wondering what could cause this.
youngday713 6 months ago
my logoMusic.start(); well the start is underlined and everything is just like what you have set up, what could be wrong?
youngday713 6 months ago
musical genius. nah.. android genius!
thatonesnowboarde 6 months ago
I just love those tutorials!!
CynicalSpix 6 months ago in playlist Android Development For Absolute Beginners
you are awesome man. Thanks a ton.
asheeshjoshi 6 months ago
i am a c#.net developer. but your tutorial helps me to learn the java in different way. and now my interest has started to focus on the Android development. so hope fully when i finish ur tutorial i should be able to come up with a product. thanks for the help that you do.
desmond80in 6 months ago
man ur a comedian !!
Payam6 7 months ago
lol...kick u down tht hole in 300...totally caught me off guard there :P...love the tutorials man...brilliant...
zanazaar 8 months ago