[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 HashSetMediaPlayer mpSet = new HashSetMediaPlayer(); static void play(Context context, int resId) { playing=true;

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 pbsdm...@gmail.com写道: Here's code that I am using repeatedly in several apps... hope this helps! :) final class PlaySound { public static boolean playing=false; private static HashSetMediaPlayer mpSet = new

[android-developers] Re: sound player

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

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 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

[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

[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 evan.yeu...@gmail.com 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

Re: [android-developers] Re: sound player

2012-02-17 Thread Mark Murphy
On Fri, Feb 17, 2012 at 6:32 PM, exax evan.yeu...@gmail.com 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)