menuitem id in xml format can't be an integer? huh. really?
Posted
by misbell
on Stack Overflow
See other posts from Stack Overflow
or by misbell
Published on 2010-03-16T19:53:30Z
Indexed on
2010/03/16
20:01 UTC
Read the original article
Hit count: 236
ok, in menu.add, you add an integer menuitem id.
But when you specify the menu in xml, @+id can't take an integer, so you can't test the id for the menu item as an integer in a switch statement.
What obvious thing am I missing, because surely an inconsistency this bone-stupid couldn't have passed muster with all those wonderful geniuses at Google.
on top of that, when I give the menu item a name like "@+id/myMenuItem", item.getItemId() returns an integer, a long one, which I guess is a representation of the hex pointer.
M
© Stack Overflow or respective owner