title: ActionMode not supported in Support Library v21 on ICS?
body: <p>I'm developing an app where I use <code>ActionMode</code>.</p>
  
  <p>Project dependencies:</p>
  
  <pre><code>dependencies {
      compile 'com.android.support:appcompat-v7:21.0.+'
      compile 'com.android.support:cardview-v7:21.0.+'
      compile 'com.android.support:support-v13:21.0+'
  }
  </code></pre>
  
  <p>API levels:</p>
  
  <pre><code>minSdkVersion 14
  targetSdkVersion 21
  </code></pre>
  
  <p>My fragment uses <code>ActionMode</code>:</p>
  
  <pre><code>@Override
  public boolean onCreateActionMode(ActionMode mode, Menu menu) {
      mode.getMenuInflater().inflate(R.menu.packing_list_context, menu);
      return true;
  }
  ...
  </code></pre>
  
  <p>Menu:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"&gt;
      &lt;item
          android:id="@+id/context_menu_item_edit"
          android:icon="@drawable/ic_edit_black_24dp"
          app:showAsAction="always"
          android:title="@string/context_menu_item_edit" /&gt;
  
      &lt;item
          android:id="@+id/context_menu_item_delete"
          android:icon="@drawable/ic_delete_black_24dp"
          app:showAsAction="always"
          android:title="@string/context_menu_item_delete" /&gt;
  
      &lt;item
          android:id="@+id/context_menu_item_tags"
          android:icon="@drawable/ic_label_black_24dp"
          app:showAsAction="always"
          android:title="@string/context_menu_item_tags" /&gt;
  &lt;/menu&gt;
  </code></pre>
  
  <p>When I run this app on Android 4.4, everything is fine. But when I run it on Android 4.0.3, I receive the following exception somewhere at Support Library:</p>
  
  <p>Stack trace:</p>
  
  <pre><code>W/System.err( 7292): java.lang.UnsupportedOperationException: This is not supported, use MenuItemCompat.getActionProvider()
  W/System.err( 7292): at android.support.v7.internal.view.menu.MenuItemImpl.getActionProvider(MenuItemImpl.java:634)
  W/System.err( 7292): at android.support.v7.internal.view.menu.MenuItemWrapperICS.getSupportActionProvider(MenuItemWrapperICS.java:322)
  W/System.err( 7292): at android.support.v7.internal.view.menu.MenuItemWrapperICS.checkActionProviderOverrideVisibility(MenuItemWrapperICS.java:348)
  W/System.err( 7292): at android.support.v7.internal.view.menu.MenuItemWrapperICS.setVisible(MenuItemWrapperICS.java:183)
  W/System.err( 7292): at android.support.v7.internal.view.SupportMenuInflater$MenuState.setItem(SupportMenuInflater.java:425)
  W/System.err( 7292): at android.support.v7.internal.view.SupportMenuInflater$MenuState.addItem(SupportMenuInflater.java:479)
  W/System.err( 7292): at android.support.v7.internal.view.SupportMenuInflater.parseMenu(SupportMenuInflater.java:196)
  W/System.err( 7292): at android.support.v7.internal.view.SupportMenuInflater.inflate(SupportMenuInflater.java:118)
  W/System.err( 7292): at net.cornplay.tourist.fragments.PackingListFragment.onCreateActionMode(PackingListFragment.java:392)
  W/System.err( 7292): at android.widget.AbsListView$MultiChoiceModeWrapper.onCreateActionMode(AbsListView.java:5635)
  W/System.err( 7292): at android.support.v7.internal.view.SupportActionModeWrapper$CallbackWrapper.onCreateActionMode(SupportActionModeWrapper.java:151)
  W/System.err( 7292): at android.support.v7.app.ActionBarActivityDelegateBase$ActionModeCallbackWrapper.onCreateActionMode(ActionBarActivityDelegateBase.java:1367)
  W/System.err( 7292): at android.support.v7.internal.app.WindowDecorActionBar$ActionModeImpl.dispatchOnCreate(WindowDecorActionBar.java:1012)
  W/System.err( 7292): at android.support.v7.internal.app.WindowDecorActionBar.startActionMode(WindowDecorActionBar.java:510)
  W/System.err( 7292): at android.support.v7.app.ActionBarActivityDelegateBase.startSupportActionMode(ActionBarActivityDelegateBase.java:576)
  W/System.err( 7292): at android.support.v7.app.ActionBarActivityDelegateHC.startActionModeForChild(ActionBarActivityDelegateHC.java:62)
  W/System.err( 7292): at android.support.v7.internal.widget.NativeActionModeAwareLayout.startActionModeForChild(NativeActionModeAwareLayout.java:44)
  W/System.err( 7292): at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:571)
  W/System.err( 7292): at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:571)
  W/System.err( 7292): at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:571)
  W/System.err( 7292): at android.view.ViewGroup.startActionModeForChild(ViewGroup.java:571)
  W/System.err( 7292): at android.view.View.startActionMode(View.java:3607)
  W/System.err( 7292): at android.widget.AbsListView.setItemChecked(AbsListView.java:952)
  W/System.err( 7292): at net.cornplay.tourist.fragments.PackingListFragment.onItemLongClick(PackingListFragment.java:350)
  W/System.err( 7292): at net.cornplay.tourist.adapters.PackingListAdapter$2.onLongClick(PackingListAdapter.java:87)
  W/System.err( 7292): at android.view.View.performLongClick(View.java:3547)
  W/System.err( 7292): at android.view.View$CheckForLongPress.run(View.java:14088)
  W/System.err( 7292): at android.os.Handler.handleCallback(Handler.java:605)
  W/System.err( 7292): at android.os.Handler.dispatchMessage(Handler.java:92)
  W/System.err( 7292): at android.os.Looper.loop(Looper.java:137)
  W/System.err( 7292): at android.app.ActivityThread.main(ActivityThread.java:4424)
  W/System.err( 7292): at java.lang.reflect.Method.invokeNative(Native Method)
  W/System.err( 7292): at java.lang.reflect.Method.invoke(Method.java:511)
  W/System.err( 7292): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
  W/System.err( 7292): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
  W/System.err( 7292): at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Google hints to these issues: <a href="https://code.google.com/p/android/issues/detail?id=77724" rel="nofollow">https://code.google.com/p/android/issues/detail?id=77724</a>, <a href="https://code.google.com/p/android/issues/detail?id=78212" rel="nofollow">https://code.google.com/p/android/issues/detail?id=78212</a>. But how can they be related to my code? I don't use <code>ShareActionProvider</code>.</p>
  
  <p>Any ideas?</p>