so i got logCat working (good thing to know about) and i got the this
actually working (think it had to be inside a method?) The real
problem, maybe from the start, is that whenever it calls
"music.start()", music being the media player, it crashes. The
debugger shows that music is null and i'm assuming that it shouldn't
be. Any ideas?

On Feb 17, 4:53 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> 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 <evan.yeu...@gmail.com> wrote:
> > On Feb 17, 3:16 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> >> On Fri, Feb 17, 2012 at 3:14 PM,exax<evan.yeu...@gmail.com> 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 android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > 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/commonsguyhttp://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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to