admin管理员组文章数量:1026380
How to run an action in a loop in Android . I tried this code but it is not what i need, I need to call a function in which with help of TTS a word must be spoken and then loop to the next word until to the end of string array. my code:
playButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(minusButton.isEnabled()){
minusButton.setEnabled(false);
}
if(plusButton.isEnabled()){
plusButton.setEnabled(false);
}
new Thread() {
@Override
public void run() {
do {
speakText();
}
while (i <= myTextCharater.length);
}
}.start();
}
});
Function code:
private void speakText(){
String str = myTextCharater[i];
tts.setSpeechRate(Float.parseFloat(speedSpeakFinal + "f"));
tts.speak(str, TextToSpeech.QUEUE_ADD, null, null);
i++;
}
The problem is that it loops to the end end only last word is pronounced.
Each spoken word must change its color during pronouncing and back.
How to run an action in a loop in Android . I tried this code but it is not what i need, I need to call a function in which with help of TTS a word must be spoken and then loop to the next word until to the end of string array. my code:
playButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(minusButton.isEnabled()){
minusButton.setEnabled(false);
}
if(plusButton.isEnabled()){
plusButton.setEnabled(false);
}
new Thread() {
@Override
public void run() {
do {
speakText();
}
while (i <= myTextCharater.length);
}
}.start();
}
});
Function code:
private void speakText(){
String str = myTextCharater[i];
tts.setSpeechRate(Float.parseFloat(speedSpeakFinal + "f"));
tts.speak(str, TextToSpeech.QUEUE_ADD, null, null);
i++;
}
The problem is that it loops to the end end only last word is pronounced.
Each spoken word must change its color during pronouncing and back.
本文标签: Independent action in loop AndroidStack Overflow
版权声明:本文标题:Independent action in loop Android - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745645909a2161025.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论