声音池加载监听器



我加载一个声音到soundpool,然后:

mySoundPool.setOnLoadCompleteListener(new OnLoadCompleteListener() {
        public void onLoadComplete(SoundPool soundPool, int sampleId,
                int status) {
            loaded = true;
        }
    });

我的问题是,我怎样才能让声音在加载后直接播放,而不需要用户做任何事情,比如触摸按钮?

谢谢

SoundPool.setOnLoadCompleteListner(new OnLoadCompleteListner(){
@override
onLoadComplete(SoundPool soundPool, int sampleId, int status)
{
    if(status == 0)
    soundPool.play(soundId, 1.0f, 1.0f, 0, 0, 0.0f);
}});

最新更新