How do I access menu items?

后端 未结 2 1925
滥情空心
滥情空心 2020-12-10 12:05

So I\'m trying to grab my menu items off the ActionBar and set them into some variables to use later. Below is some basic test code that tries to set the variable during the

2条回答
  •  抹茶落季
    2020-12-10 12:58

    getItem(int) returns a MenuItem at a specific index, while findItem(int) returns a MenuItem corresponding to the resource ID that is given. Call findItem instead of getItem.

    http://developer.android.com/reference/android/view/Menu.html#findItem(int)

提交回复
热议问题