1

Following the documentation here [1] to add voice menu options, is there an upper limit on the number of voice menu items that can be displayed in a Glass app? I've tried the gdk-apidemo-sample [2] and added the following to add an additional voice menu item:

  • added to string.xml <string name="menu_coder6">Foxtrot</string>
  • added to voice_menu.xml <item android:id="@+id/menu_coder6" android:title="@string/menu_coder6" />
  • added to VoiceMenuActivity, the method onMenuItemSelected() case R.id.menu_coder6: mPicture = 7; break; and to the method getImageResource() case 7: return R.drawable.codemonkey1;

When I launched the app and reviewed the "coder" options, coder 6, Foxtrot was not displayed and there was no scrolling when panning up and down with my head to see additional voice menu options similar to when first saying "ok glass" to see a list of all installed apps on Glass.

[1] https://developers.google.com/glass/develop/gdk/voice#contextual_voice_commands

[2] https://github.com/googleglass/gdk-apidemo-sample

pt2121
  • 11,720
  • 8
  • 52
  • 69
tw1742
  • 1,424
  • 4
  • 18
  • 37

1 Answers1

0

had some issues with this myself, did you clean and rebuild your project? for some reason sometimes android studio doesn't add these menu items when you build and the project often needs to be cleaned(happens alot for us when building on glass we make some small changes and retest on devices and the change is not pushed to the live running code.. find some sample code for one of our contextual voice menu's with more than a couple voice items:

<?xml version="1.0" encoding="utf-8"?>

<item
    android:id="@+id/take_picture"
    android:title="@string/take_picture">
</item>

<item
    android:id="@+id/take_video"
    android:title="@string/take_video">
</item>


<item
    android:id="@+id/voice_card"
    android:title="@string/voice_card">
</item>

<item
    android:id="@+id/add_item"
    android:title="@string/add_item">
</item>

<item
    android:id="@+id/remove_item"
    android:title="@string/remove_item">
</item>

these are displayed in a head tiltable scroll list that is handled by the cardbuilder class.

medright
  • 138
  • 10