android - 谷歌眼镜 : return to voice_trigger/voice_prompt from the Activity

标签 android google-glass google-gdk

我是 Glass 开发的新手,我有一个简单的应用程序

Ok Glass => Dictionary (voice_trigger) => Say a word to search (voice_prompt) => MyActivity (app)

如果我执行 SWIPE_DOWN,我会返回到第一个 View :Ok Glass。在我的 Activity 中,我想用手势启动另一项研究,然后返回到 voice_prompt View ,而不说“Ok Glass”和“Dictionary”。

在这种情况下是否可能或我是否需要避免 voice_prompt?

谢谢

最佳答案

在您的 Activity 中,您应该能够执行以下操作:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if(keyCode == KeyEvent.KEYCODE_BACK) {
        Log.i(TAG, "BACK PUSHED");
        Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        startActivityForResult(intent, SPEECH_REQUEST);
        return true;
    }

    return super.onKeyDown(keyCode, event);
}

通过这样做,您可以停止向下滑动的默认处理程序并设置您自己的处理程序,这会导致出现语音识别 Activity (https://developers.google.com/glass/develop/gdk/voice#starting_speech_recognition)。

关于android - 谷歌眼镜 : return to voice_trigger/voice_prompt from the Activity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24637604/

相关文章:

android - 无法添加依赖 Android Studio

android - 如何检索从 Google Glass 安装的 apk 文件?

android - 如何使用GDK在卡上显示静态 map ?

google-glass - GDK Card 类中使用的可自动调整大小的 TextView 在哪里?

android - 谷歌眼镜 : imageView fullscreen?

java - 触发谷歌眼镜上的相机

android - 从 AsyncTask 更新 UI 并正确处理屏幕旋转

Android:画廊像滑动效果

Android通过电话号码有效地获取联系人姓名以在ListView中显示

google-mirror-api - 接收时间线卡有很多延迟