I have a menu in my Android application and this menu has a SubMenu. The items are exclusively selectable.
How can I remove a selection made by the user (such that the submenu looks like it was at the beginning, with no item selected?
I was looking for a method that would do this, in a similar way as the SubMenu‘s setGroupEnabled method, so I tried it by looping over the items of the submenu and call setChecked(false) on them. However, as it seems, deselecting an item in an exclusive list does not remove the selection, but shifts it to the next item. So after the loop, there was still any item selected.
What is the correct way of removing the selection (so that the user can select a new item)?
I appreciate your help.
For anyone who has the same problem, I’ve found a solution after all.
You can deselect all items in a submenu by having an invisible item in the submenu and giving the
setChecked(true)-property to this item.