According to the documentation, to add an item to a Menu programmatically you use this.
By doing Menu.add(Menu.NONE, Menu.NONE, 0, "item");
I should be able to add an item to the very top of the menu of my navigation view, but despite this, the newly created item would still be added to the bottom. What could be the problem here?
Should work for you!
Note : If you use both xml and code like below
and xml :
and if you forget to add
orderInCategory
to an item like in the 5000 one Then those items go in top giving priority to xml (check the example)