[android-developers] Re: sound player

2012-02-17 Thread exax
On Feb 17, 3:16 pm, Mark Murphy wrote: > On Fri, Feb 17, 2012 at 3:14 PM,exax 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

[android-developers] Re: sound player

2012-02-17 Thread exax
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 ass

[android-developers] Re: sound player

2012-02-17 Thread exax
Now i get a source not found error for the android.jar file. it asks me to attach source code. What does this mean??! On Feb 17, 5:52 pm, exax wrote: > 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

[android-developers] Re: sound player

2012-02-18 Thread Mark Turkel
Here's code that I am using repeatedly in several apps... hope this helps! :) final class PlaySound { public static boolean playing=false; private static HashSet mpSet = new HashSet(); static void play(Context context, int resId) { playing=true; MediaPlayer mp =

Re: [android-developers] Re: sound player

2012-02-17 Thread Mark Murphy
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 wrote: > On Feb 17, 3:16 pm, Mark Murphy wrote: >> On Fri, Feb 17, 2012 at 3:14 PM,exax wrote: >> > So, I wanted to create a simple

Re: [android-developers] Re: sound player

2012-02-17 Thread Mark Murphy
On Fri, Feb 17, 2012 at 6:32 PM, exax wrote: > Now i get a source not found error for the android.jar file. it asks > me to attach source code. What does this mean??! This means you are trying to step into source code that is not yours. -- Mark Murphy (a Commons Guy) http://commonsware.com | ht

Re: [android-developers] Re: sound player

2012-02-18 Thread Felix Long
you need call mp.prepare before mp.start 在 2012-2-19 上午3:13,"Mark Turkel" 写道: > > Here's code that I am using repeatedly in several apps... hope this > helps! :) > > final class PlaySound { >public static boolean playing=false; > >private static HashSet mpSet = new > HashSet(); > >