最近自己写了一个抽签的小程序,想着抽签之后会语音播报出来,于是就想到了简单的TextToSpeech。
首先实例化TextToSpeech
TextToSpeech texttospeech = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
// TODO Auto-generated method stub
if (status == texttospeech.SUCCESS) {
int result = texttospeech.setLanguage(Locale.CHINA);
if (result != TextToSpeech.LANG_COUNT