How to Set Focus on an Item in the Action Bar on Launch

1.2k views Asked by At

I had developed an Android app that works fine on smartphones. When trying on Amazon Fire TV, I see that no view has focus on launch and the key presses on the remote controller don't have any effect. How can I make an item on the action bar have focus (the action item should have focus, namely blue lines around it). Since no view seems to have focus, the remote controller does not work.

Do I have to add something to the layout code, which is as follows:

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

<item
    android:id="@+id/menu_item_favorites"
    android:icon="@drawable/ic_action_favorites"
    android:title="@string/favorites"
    android:showAsAction="always" />

...
...
...

</menu>

or do I have to set focus programmatically in onCreate or onStart?

0

There are 0 answers