Problem with a SoundManager.

All your problems with Audio, Video and Images.

Problem with a SoundManager.

Postby klix666 » Sat Jun 11, 2011 1:46 am

The problem with the code below is when I press tom, jane.mp3 plays, and when I press jane, the app crashes. But if I remove the sound jane.mp3 from the soundmanager, tom all of the sudden works again. Weird right?





public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

mSoundManager = new SoundManager();
mSoundManager.initSounds(getBaseContext());
mSoundManager.addSound(1, R.raw.tom);
mSoundManager.initSounds(getBaseContext());
mSoundManager.addSound(2, R.raw.jane);


setListAdapter(new ArrayAdapter<String>(this, R.layout.main2, items));

ListView lv = getListView();
lv.setTextFilterEnabled(true);

lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// When clicked, show a toast with the TextView text
Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
Toast.LENGTH_SHORT).show();

if (items[position]=="tom")
{
mSoundManager.playSound(1);
}
else if (items[position]=="jane")
{
mSoundManager.playSound(2);
}

}
});
klix666
Freshman
Freshman
 
Posts: 4
Joined: Wed Jun 08, 2011 1:53 am

Top

Re: Problem with a SoundManager.

Postby rdklein » Mon Jun 13, 2011 9:23 am

looks like mSoundManager.playSound(0); will play tom and (1) Jane.

But where do you get SoundManager from - it seems not to be part of the documented Android SDK ?
rdklein
Freshman
Freshman
 
Posts: 2
Joined: Mon Jun 13, 2011 8:49 am
Location: Germany, Munich

Re: Problem with a SoundManager.

Postby klix666 » Tue Jun 14, 2011 10:45 pm

Its in another public class called SoundManager.java
klix666
Freshman
Freshman
 
Posts: 4
Joined: Wed Jun 08, 2011 1:53 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 5 guests