How to press menu items in Robotium?

In this article we are going to see how to check different items from menu. Basically, the items that comes when we press menu button.

We need to initiate the Solo object. After initiation, we will uses solo to get those.

-To click an items with a text present in the menu.
solo.clickOnMenuItem("ItemName");


-To click an items with a text present in the menu or the sub-menu. If it is true in second parameter, it will check all sub-menu items.
solo.clickOnMenuItem("ItemName", false);


Note: This text will be used as regular expression(it will match with all items of the menu)

-To click a menu item based on it's index(0 Based, integer).
solo.pressMenuItem(0);


-To click a menu item based on it's index(0 Based, integer). In here, we need to mention the number of items present in each row(in integer).
solo.pressMenuItem(0, 3);


Note : In here, Index are sequentially made. Ex- if there are 2 rows and 4 items in each column, index 0=1st row, 1st item and 5=2nd row 2nd item

-To click a Drop Down Menu item based on it's deop down menu index and item index( both are 0 Based integer). First parameter is the index of drop down menu, 2nd one is the item index.
solo.pressSpinnerItem(2, 0);
-I here, Negative number in 2nd parameter(as item index) will move clicking to Up, positive number will be to Down.


..Thanks...:)