So I am using soundpool to play a sound at the end of a timer. onCreate I am doing this
int mySoundId;
SoundPool soundPool;
// load sound
soundPool = new SoundPool(5, AudioManager.STREAM_MUSIC, 0);
AssetManager am = this.getAssets();
//Use in whatever method is used to load the sounds
try {
mySoundId = soundPool.load(am.openFd("alarm.wav"), 1);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I was getting
sample 0 not READY
So I figured out I had to use
soundPool.setOnLoadCompleteListener(new OnLoadCompleteListener() {
@Override
public void onLoadComplete(SoundPool soundPool, int mySoundId, int status) {
loaded = true;
}
});
But my problem is, setOnLoadCompleteListener gives me the following error
The method setOnLoadCompleteListener(SoundPool.OnLoadCompleteListener) in the type SoundPool is not applicable for the arguments (new OnLoadCompleteListener(){})
I have tried various things, such as "Android Tools -> Fix Project Properties" and fiddling with "Properties -> Java Compiler" but no joy. My API range is 10 - 16 so it should be ok. Any ideas what its having issues with?