0

I'm using com.actionbarsherlock.view.ActionMode and when I try to get the clicked item id like this:

    public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
            Toast.makeText(WeiboActivity.this, "Got click: " + item.getItemId(), Toast.LENGTH_SHORT).show();
            return false;
        }
    }

it's always:

Got click: 0

So what is the right code to get the clicked item id?

4

1 回答 1

2

创建菜单项时,您需要在调用中包含项目 ID

menu.add(Menu.NONE, R.id.menu_test, Menu.NONE, R.string.menu_test)
于 2013-03-25T18:24:32.830 回答