XML : Get unique identifier for ContextMenu in Android?


have xml resource for my context menu mymenu.xml.
Want every menu inflated from this xml to provide some unique identifier - so I know it was inflated from mymenu.xml file.

Tried hashCode() or toString() on Menu but found out,
that new Menu instance is created everytime inflate is called, so these values are different on each run.

<menu> tag cannot have some unique attribute set also.

So, my question:
Is it possible to get String containing name of xml from which was menu inflated,
( in my case "mymenu"),
or some other per-xml unique value, which would not be defined programatically by me?
(for example summing id's from all its MenuItems)

Thanks for any response :)

No comments:

Post a Comment