title: Android PopupMenu checkable item does not check
body: <p>I have this simple PopupMenu, but when I click on an item, the item doesn't get checked. Why?</p>
  
  <p>In documentation is:
  Menu items in the Icon Menu (from the options menu) cannot display a checkbox or radio button.
  Radio button is showing, but only state is not changing...</p>
  
  <p>Java</p>
  
  <pre><code>public void showSortPopup() {
      View menuItemView = findViewById(R.id.action_sort);
      PopupMenu popup = new PopupMenu(this, menuItemView);
      popup.inflate(R.menu.sort);
      popup.getMenu().findItem(R.id.sort_def).setChecked(true);
      popup.setOnMenuItemClickListener(new OnMenuItemClickListener() {
  
          @Override
          public boolean onMenuItemClick(MenuItem item) {
  
              switch (item.getItemId()) {
                  case R.id.sort_def:
                      sortOrder = CardCursorContract.CardCursor.DEFAULT_SORT;
                      mCardsFragment.setSortOrder(sortOrder);
                      savePref();
                      if (item.isChecked()) item.setChecked(false);
                      else item.setChecked(true);
                      break;
                  case R.id.sort_asc:
                      sortOrder = CardCursorContract.CardCursor.ALPHABETICAL_ASC_SORT;
                      mCardsFragment.setSortOrder(sortOrder);
                      savePref();
                      if (item.isChecked()) item.setChecked(false);
                      else item.setChecked(true);
                      break;
                  case R.id.sort_desc:
                      sortOrder = CardCursorContract.CardCursor.ALPHABETICAL_DESC_SORT;
                      mCardsFragment.setSortOrder(sortOrder);
                      savePref();
                      if (item.isChecked()) item.setChecked(false);
                      else item.setChecked(true);
                      break;
                  default:
                      break;
              }
              return false;
          }
      });
      popup.show();
  }
  </code></pre>
  
  <p>XML-File</p>
  
  <pre><code>&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;group android:checkableBehavior="single"&gt;
  &lt;item android:id="@+id/sort_def"
        android:title="@string/action_sort_def"
        android:orderInCategory="1"
        android:showAsAction="always" /&gt;
  
  &lt;item android:id="@+id/sort_asc"
        android:title="@string/action_sort_name"
        android:orderInCategory="2"
        android:showAsAction="always" /&gt;
  
  &lt;item
        android:id="@+id/sort_desc"
        android:title="@string/action_sort_name_desc"
        android:orderInCategory="3"
        android:showAsAction="always"/&gt;
  &lt;/group&gt;
  </code></pre>
  
  <p></p>
  
  <p>Screen</p>
  
  <p><img src="https://i.stack.imgur.com/CHqGw.png" alt="enter image description here"></p>