Is there a possibility, to add an image to menu item, from java code (not from xml file)?
For example (in XML):
item android:id="@+id/help"
android:icon="@drawable/ic_help"
android:title="@string/help"
Second line adds a picture (icon) to an item, but this is XML file.
In code, when I’m making a menu there is only few constructor to add an item
For example:
public boolean onCreateOptionsMenu(Menu menu){
menu.add(0,0,0,"Czerwony");
But anyone with image (only title text/string).
Please Also see this article: How to create Menus in Android in Java Code