问题描述
怎么样,我需要播放5个随机音频,一个又一个...我已经解决了随机功能,但是我希望这5个音频之间有大约1秒的时间间隔,我可以使用这种形状的SLEEP:
//play the sounds consecutively
sonidoIndexA();
espera();
sonidoIndexB();
espera();
sonidoIndexC();
espera();
sonidoIndexD();
respuestaCorrecta = Integer.toString(indexA) + Integer.toString(indexB) +
Integer.toString(indexC) + Integer.toString(indexD);
System.out.println(respuestaCorrecta);
}
//Wait a certain time
private void espera() {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
但是SLEEP给我带来了一些与时间有关的问题,因为我希望在播放这些音频时禁用某些按钮,但是使用SLEEP只能在播放音频之前实现... SLEEP是否可以替代?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)