我的应用程序包括tts
和stt
. 我的应用程序通过语音命令运行。
所以,我想使用back button
. 当 userclick back button
时,应用程序应该进入第一步,但它没有。
我的代码;
public class SpeechActivity extends FragmentActivity implements Const {
protected PowerManager.WakeLock mWakeLock;
private SpeechRecognizer mSpeechRecognizer;
private Intent mSpeechRecognizerIntent;
private SpeechRecognitionListener srListener;
private Vocalizer vocalizer;
private Object lastTtsContext = null;
.......
@Override
public void onBackPressed() {
speakToDisabled(Const.COMMAND_WARNING_MESSAGE);
super.onBackPressed();
try {
mSpeechRecognizer.wait();
} catch (InterruptedException e) {
speakToDisabled(Const.COMMAND_BYE);
}
}