title: How to use contextual action mode with SherlockListFragment
body: <p>I want use a Contextual Action Bar (CAB) in my app but is not compatible with old versions of Android so I'm using this tutorial: <a href="http://www.miximum.fr/tutos/849-porting-the-contextual-anction-mode-for-pre-honeycomb-android-apps" rel="nofollow">http://www.miximum.fr/tutos/849-porting-the-contextual-anction-mode-for-pre-honeycomb-android-apps</a>
  My code is:</p>
  
  <pre><code>public class SongsFragment extends SherlockListFragment implements
      LoaderManager.LoaderCallbacks&lt;Cursor&gt;, OnLongClickListener{
  
  ...
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
      super.onActivityCreated(savedInstanceState);
      activity = this.getActivity();
      ...
      mMode = null;
      mListView = getListView();
      mListView.setItemsCanFocus(false);
      mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
      mListView.setOnLongClickListener(this);
  
  }
  
  @Override
  public boolean onLongClick(View v) {
      SparseBooleanArray checked = mListView.getCheckedItemPositions();
      boolean hasCheckedElement = false;
      for (int i = 0; i &lt; checked.size() &amp;&amp; !hasCheckedElement; i++) {
          hasCheckedElement = checked.valueAt(i);
      }
  
      if (hasCheckedElement) {
          if (mMode == null) {
              mMode = activity.startActionMode(mActionModeCallback);
          }
      } else {
          if (mMode != null) {
              mMode.finish();
          }
      }
      return false;
  }
  
   private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
  
      @Override
      public boolean onCreateActionMode(ActionMode mode, Menu menu) {
          // Create the menu from the xml file
          activity.getSupportMenuInflater().inflate(R.menu.cab_songs, menu);
          return true;
      }
      ...
  </code></pre>
  
  <p>I have errors in:</p>
  
  <ol>
  <li>-"activity.startActionMode(mActionModeCallback);": The method startActionMode(ActionMode.Callback) in the type Activity is not
  applicable for the arguments (ActionMode.Callback)</li>
  <li>-activity.getSupportMenuInflater().inflate(R.menu.cab_songs, menu);": The method getSupportMenuInflater() is undefined for the
  type FragmentActivity</li>
  </ol>
  
  <p>Any idea? is there another solution for CAB using sherlock?</p>