Home » Android » android – Why doesn't this AlertDialog.Builder.setIcon show the ic_menu_info icon?

android – Why doesn't this AlertDialog.Builder.setIcon show the ic_menu_info icon?

Posted by: admin June 15, 2020 Leave a comment

Questions:

The ic_menu_info icon is properly displayed in the xml menu item that calls it but not in this AlertDialog.

new AlertDialog.Builder(this).setMessage(menuInfo).setNeutralButton("OK",
 new DialogInterface.OnClickListener() {
  public void onClick(DialogInterface d, int i) {
   // do nothing – it will close on its own
  }
 })
 .setIcon(R.drawable.ic_menu_info).show();
 ...
How to&Answers:

Needed a .setTitle() since that is where the icon wants to go.