谷歌的Andr​​oid玻璃:我如何使用语音触发从当前的活动(从cardscroller切换卡) [英] Google Glass Android : How can i use voice trigger from current Activity (to switch cards from cardscroller)

查看:139
本文介绍了谷歌的Andr​​oid玻璃:我如何使用语音触发从当前的活动(从cardscroller切换卡)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的 cardscrollview 在活动中表现出的文字和pitcures不同的卡。

I am using a cardscrollview in an Activity to show text and pitcures on different cards.

今天,我可以通过触摸板和向左或向右滑动,但我想用语音卡之间滚动滚动。

Today i can scroll by using touchpad and swipe left or right but i want to scroll between cards using voice.

例如:当我说下一个我想向前滚动,而当我说preV我想向后滚动

Example : when i say "next" i would like to scroll forward, and when i say "prev" i would like to scroll backwards.

我看到像<一个计算器不同的答案href=\"http://stackoverflow.com/questions/21168267/glass-voice-command-nearest-match-from-given-list/21251558#21251558\">this 之一或<一个href=\"http://stackoverflow.com/questions/21652321/how-to-navigate-a-google-glass-gdk-immersion-application-using-voice-command-onl\">this 之一,它看起来像你不能包括GlassVoice.jar了(尝试过,但不工作)。我看到了,我可以用语境声控命令谷歌文档,但我真的不明白如何将它包含了我的情况。

I saw different answers on stackoverflow like this one or this one and it looks like you can't include GlassVoice.jar anymore (tried it but not working). I saw on google documentation that i could use Contextual voice commands but i don't really understand how to include it for my case.

我想有这样的事情:

if(voicetrigger == "next"){
    scrollForward();
}

你觉得有可能吗?我将不胜感激,如果有人可以帮助我,或有想法,使其正常工作。

Do you think it's possible to do ? I would be grateful if someone could help me or have ideas to make it work.

感谢

推荐答案

实现与菜单项,如下一步,情境声控命令previous。一旦这些项目中的一个被触发,叫 setSelection(INT位置)上的参数是不是当前位置+ 1或-1。

Implement contextual voice commands with menu items such as "Next" and "Previous." Once one of those items is triggered, call setSelection(int position) on your CardScrollView with the parameter being either the current position + 1 or -1.

下面就是我如何使用这些方法在我的样本 onMenuItemSelected

Here's a sample of how I use that method in my onMenuItemSelected:

mCardScroller.setSelection(mCardScroller.getSelectedItemPosition() + 1);

这篇关于谷歌的Andr​​oid玻璃:我如何使用语音触发从当前的活动(从cardscroller切换卡)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆