0

I am trying to display icons for menu items created in an activity in google glass application. Here is my code.

if (featureId == WindowUtils.FEATURE_VOICE_COMMANDS) {
getMenuInflater().inflate(R.menu.voice_menu, menu);
return true;
}

And my menu.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/navigate"
        android:title="Navigate"/>
    <item
        android:id="@+id/back"
        android:icon="@drawable/icon2"
        android:title="Back"
        android:showAsAction="always|withText"/>
</menu>

But if i say "ok glass" it will show only menu title, no menu icon is shown. Please help me to proceed.

Shine
  • 3,788
  • 1
  • 36
  • 59
user3678419
  • 11
  • 1
  • 4

1 Answers1

0

With the "Ok Glass" menu (named Contextual Voice Command), you can't add any icon With XE19 you can't add more than 6 items and custom the display of the "Ok Glass".

If you put an icon in your menu.xml, this icon will only appear if you use a classic menu calling this function :

openOptionsMenu();

If you use a voice command menu using the code below, the icon won't appear :

getWindow().requestFeature(WindowUtils.FEATURE_VOICE_COMMANDS);
Pull
  • 2,236
  • 2
  • 16
  • 32
  • I will update my answer to answer to be clearer. Call openOptionsMenu() instead, you will see the difference – Pull Sep 01 '14 at 09:19