title: How to prevent popup menu from closing on checkbox click
body: <p>I search a lot on net but there is nothing about preventing popup menu from closing.</p>
  
  <p>Whenever i click on checkbox item or any other popup menu item, popup menu dismiss itself. How can i prevent it from dismissing when user check/uncheck checkbox in popup menu.</p>
  
  <p>I'm showing popup menu on actionbar-menu item's click event.</p>
  
  <pre><code>//main_menu.xml
  &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  tools:context="com.worldofjobs.woj.MainActivity" &gt;
  
  &lt;item
      android:id="@+id/action_popUpMenu"
      android:icon="@drawable/ic_action_overflow"
      android:title="@string/main_action_popUpMenu"
      app:showAsAction="always"/&gt;
  
  &lt;/menu&gt;
  
  //popup_items.xml
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" &gt;
  
  &lt;item
      android:id="@+id/refresh_item"
      android:title="@string/main_refresh"/&gt;
  &lt;item
      android:id="@+id/checkbox_item"
      android:checkable="true"
      android:title="Start notification"/&gt;
  &lt;item
      android:id="@+id/changePasswrod_item"
      android:title="@string/main_changePassword"/&gt;
  &lt;item
      android:id="@+id/deleteAccount_item"
      android:title="@string/main_deleteAccount"/&gt;
  &lt;item
      android:id="@+id/logout_item"
      android:title="@string/main_logout"/&gt;
  
  &lt;/menu&gt;
  
  /**
   * Shows popup menu on click of action bar-menu inflates from
   * menu.pop_items-xml
   */
  private void showPopup() {
  
      try {
  
          View v = findViewById(R.id.action_popUpMenu);
  
          PopupMenu popup = new PopupMenu(this, v);
          popup.setOnMenuItemClickListener(MainActivity.this);
  
          MenuInflater inflater = popup.getMenuInflater();
          inflater.inflate(R.menu.pop_items, popup.getMenu());
          popup.show();
  
      } catch (Exception e) {
  
          Log.e("MainActivity-showPopup:", e.toString());
      }
  }
  
  /**
   * Handles click events of popup menu items
   */
  @Override
  public boolean onMenuItemClick(MenuItem item) {
  
      super.onMenuItemSelected(1, item);
      switch (item.getItemId()) {
  
      case R.id.refresh_item:
          refresh();
          return true;
  
      case R.id.checkbox_item:
          return true;
  
      case R.id.changePasswrod_item:
          changePasswordPopup();
          return true;
  
      case R.id.deleteAccount_item:
          deleteAccount();
          return true;
  
      case R.id.logout_item:
          session.logout();
          finish();
          return true;
      }
      return true;
  }
  </code></pre>