【发布时间】:2015-01-15 16:26:05
【问题描述】:
有人可以帮助我使用带有 API 21 的 TTS。 版本 21 已弃用所有可用示例
这是我在最后一行给出错误的代码:
Calendar cal = Calendar.getInstance();
cal.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
String text = sdf.toString();
btn.setText("Ouvir as Horas");
TextToSpeech tts = new TextToSpeech(NightClock.this,(TextToSpeech.OnInitListener) NightClock.this);
tts.setLanguage(Locale.US);
tts.speak(text, TextToSpeech.QUEUE_FLUSH, null);
在 Android 开发人员中,它表示此方法已被弃用并由以下内容取代:
speak(字符串文本,int queueMode,HashMap 参数) 此方法在 API 级别 21 中已弃用。从 API 级别 21 开始,由 speak(CharSequence, int, Bundle, String) 取代。
有人可以帮我编写应用程序的代码吗?
【问题讨论】:
标签: android api text-to-speech