Code example for MenuItem

Methods: getGroupId

0
        mMenu.add(0, 0, item1Index - 1, "ignore");
        final MenuItem item = mMenu.add(groupId, 0, item1Index, "test");
        mMenu.add(0, 0, item2Index - 1, "ignore");
        final MenuItem item2 = mMenu.add(groupId, 0, item2Index, "test2");
         
        Assert.assertEquals(groupId, item.getGroupId());
        Assert.assertEquals(groupId, item2.getGroupId());
        Assert.assertEquals(item1Index, mMenu.findGroupIndex(groupId));
        Assert.assertEquals(item2Index, mMenu.findGroupIndex(groupId, item1Index + 1));
    } 
     
    @SmallTest 
    public void testGroup() { 
        // This test does the following 
        //  1. Create a grouped item in the menu 
        //  2. Check that findGroupIndex() finds the grouped item. 
        //  3. Check that findGroupIndex() doesn't find a non-existent group. 
 
        final int GROUP_ONE = Menu.FIRST;
        final int GROUP_TWO = Menu.FIRST + 1;
Connect your IDE to all the code out there  Get Codota for Java