Use adb logcat, DDMS, or the LogCat view in Eclipse to examine LogCat and look at the stack trace associated with your error.
On Fri, Feb 17, 2012 at 4:42 PM, exax <[email protected]> wrote: > On Feb 17, 3:16 pm, Mark Murphy <[email protected]> wrote: >> On Fri, Feb 17, 2012 at 3:14 PM,exax<[email protected]> wrote: >> > So, I wanted to create a simple sound player that will just play a >> > sound when I touch a button. I created it without errors but it >> > crashes everytime i run it. I got rid of all the extra code and found >> > that the error is coming from the media player initialization >> >> > public MediaPlayer music = MediaPlayer.create >> > (getApplicationContext(), R.raw.sound_1); >> >> > I believe this is due to my lack of understanding context. i need some >> > help figuring out what context to put into the first parameter. >> >> Try: >> >> public MediaPlayer music = MediaPlayer.create(this, R.raw.sound_1); >> >> -- >> Mark Murphy (a Commons >> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy >> >> Warescription: Three Android Books, Plus Updates, One Low Price! > > That's actually what I originally had before I added the > getApplicationContext(). > The error message I get is that the application has stopped > unexpectedly and that I have to force close it. not sure what's going > on... > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, One Low Price! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

