嗨我有一个按钮从中调用给定的方法问题是当我第一次单击按钮时TextToSpeach播放器不播放声音但处理程序代码执行完美。如果我再次点击按钮一切正常工作意味着TextToSpeach播放声音。谢谢..
public void selectDest() {
TextToSpeechPlayer.playSound("hello");
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Log.d(TAG, "After 1 sec ");
}
},1000);
}
答案 0 :(得分:0)
试试这个
TextToSpeechPlayer.playSound("hello");
handler = new Handler();
runnable = new Runnable() {
public void run() {
//do your other task here
handler.postDelayed(this, 60 * 1000);
}
};
handler.postDelayed(runnable, 0);
答案 1 :(得分:0)
public void selectDest() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
TextToSpeechPlayer.playSound("hello");
Log.d(TAG, "After 1 sec ");
}
},1000);
}