How to show icon with option menu.I have tried the following code but my option menu is without image icon.I am using android version 4.0 for developing app.
Jav
You Can try Following this Link.
Check this out and tell me if it worked or not.
Or you can do some thing like this.
Create menu.xml
And now you will be able to set ICON on menu
Now in CreateOptionMenu
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
And to access that menu.
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.next:
Toast.makeText(this, "You have chosen the " + getResources().getString(R.string.next) + " menu option",
Toast.LENGTH_SHORT).show();
return true;
…
default:
return super.onOptionsItemSelected(item);
}
}