title: Menu popup helper cannot be used without anchor
body: <p>I want to use popup to a menu item in action bar. It's everything ok when I use this in the Activity but when I switch to fragment I get:</p>
  <pre><code>MenuPopupHelper cannot be used without an anchor
  </code></pre>
  <p>my fragment:</p>
  <pre><code>@Override
  public boolean onOptionsItemSelected(MenuItem item) {
      
      switch(item.getItemId()) {
          case R.id.action_filter:
              createCategoriesPopupMenu(item);
              return true;
          case R.id.action_sort:
              createSortPopupMenu(item);
              return true;
          default:
              return super.onOptionsItemSelected(item);
      }
  }
  
  
  private void createSortPopupMenu(MenuItem item)
  {
      PopupMenu popup;
      
      final View menuItemView = getView().findViewById(item.getItemId());
      
      Log.wtf(&quot;d&quot;,&quot;item getitemid&quot;+item.getItemId());
      
      if (menuItemView == null)
      {
          Log.wtf(&quot;d&quot;,&quot;menuItemView==null view&quot;+view.findViewById(item.getItemId()));
          Log.wtf(&quot;d&quot;,&quot;menuItemView==null getAc&quot;+getActivity().findViewById(item.getItemId()));
          
          //final View searchItemView = getView().findViewById(R.id.action_search);
          //popup = new PopupMenu(getActivity(), searchItemView);
      }
  
          popup = new PopupMenu(getActivity(), menuItemView);
  
      Menu menu = popup.getMenu();
      
      addSortMenuItems(menu);
  
      popup.setOnMenuItemClickListener(new OnMenuItemClickListener()
      {
          @Override
          public boolean onMenuItemClick(MenuItem item)
          {
              onSortMenuItemClick(item);
              return true;
          }
      });
  
      popup.show();
  }   
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
      inflater.inflate(R.menu.issues_list_menu, menu);
  
      super.onCreateOptionsMenu(menu, inflater);
  }
  </code></pre>
  <p>console output(assert):</p>
  <blockquote>
  <p>07-08 14:08:16.659: A/d(1677): item getitemid2131165600 07-08</p>
  <p>14:08:16.659: A/d(1677): menuItemView==null viewnull 07-08</p>
  <p>14:08:16.663: A/d(1677): menuItemView==null getAcnull</p>
  </blockquote>
  <p>I did't forgot setHasOptionsMenu(true); in onCreateView()
  and <code>view</code> is inflated layout from <code>onCreateView()</code></p>