code: public void show(IBinder windowToken) {
          // Many references to mMenu, create local reference
          final MenuBuilder menu = mMenu;
  
          // Get the builder for the dialog
          final AlertDialog.Builder builder = new AlertDialog.Builder(menu.getContext());
  
          mPresenter = new ListMenuPresenter(builder.getContext(), R.layout.abc_list_menu_item_layout);
  
          mPresenter.setCallback(this);
          mMenu.addMenuPresenter(mPresenter);
          builder.setAdapter(mPresenter.getAdapter(), this);
  
          // Set the title
          final View headerView = menu.getHeaderView();
          if (headerView != null) {
              // Menu's client has given a custom header view, use it
              builder.setCustomTitle(headerView);
          } else {
              // Otherwise use the (text) title and icon
              builder.setIcon(menu.getHeaderIcon()).setTitle(menu.getHeaderTitle());
          }
  
          // Set the key listener
          builder.setOnKeyListener(this);
  
          // Show the menu
          mDialog = builder.create();
          mDialog.setOnDismissListener(this);
  
          WindowManager.LayoutParams lp = mDialog.getWindow().getAttributes();
          lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
          if (windowToken != null) {
              lp.token = windowToken;
          }
          lp.flags |= WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
  
          mDialog.show();
      }
docs: Shows menu as a dialog.
  
  @param windowToken Optional token to assign to the window.