I'm trying to get a sound to play from a widget. The code (below) is a
near copy of code from another project which successfully plays
sounds. The sounds which I use work in other projects, and working
sounds from other projects also don't play in this project.
I think I just need a pair of fresh eyes.
Thanks for any insight!
.......
public void onReceive(Context context, Intent intent){
.......
//for deciding which sound to play
int soundToPlay;
.......
/******************
* Play the sound *
******************/
//make a sound pool
SoundPool soundPool = new SoundPool(4, AudioManager.STREAM_MUSIC,
0);
int soundID = soundPool.load(context, soundToPlay, 1);
/****************************************************
* this shows soundPool.play() returning a 0 *
****************************************************/
CharSequence text = soundID + " -> " + soundPool.play(soundID, 1,
1, 1, -1, 1);
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
.......
--
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