如何在TextToSpeech android上添加换行符?

时间:2015-09-09 09:00:56

标签: java android text-to-speech

我在android中使用dot阅读文本。在我的情况下,我有4个字符串,字符串之间的延迟很小。我在字符串的末尾添加了句号。但它的内容为public class TextToSpeechUtil implements TextToSpeech.OnInitListener, TextToSpeech.OnUtteranceCompletedListener { private Activity activity; private String message; private TextToSpeech tts; public TextToSpeechUtil(Activity activity, String message) { this.activity = activity; this.message = message; tts = new TextToSpeech(activity, this); tts.setLanguage(Locale.US); } public void shutdown() { // Don't forget to shutdown tts! if (tts != null) { tts.stop(); tts.shutdown(); } } @Override public void onInit(int status) { if (status == TextToSpeech.SUCCESS) { int result = tts.setLanguage(Locale.US); if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) { Log.e("TTS", "This Language is not supported"); } else { speakOut(); } tts.setOnUtteranceCompletedListener(this); } else { Log.e("TTS", "Initilization Failed!"); } } private void speakOut() { HashMap<String, String> hashAlarm = new HashMap<>(); hashAlarm.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, message); tts.speak(message, TextToSpeech.QUEUE_FLUSH, hashAlarm); } @Override public void onUtteranceCompleted(String utteranceId) { shutdown(); } } 。这就是我试过的,

speechUtil = new TextToSpeechUtil(this, "String 1."
            .concat("String 2.")
            .concat("String 3.")
            .concat("String 4.")
            .concat("String 5."));

消息字符串

... WHERE categorie_bit = 1 OR categorie_bit = 0

这些字符串不断读取。我该如何解决这个问题?

0 个答案:

没有答案