title: Use a custom contextual action bar for WebView text selection
body: <p>I have used <a href="http://developer.android.com/guide/topics/ui/menus.html#CAB">this guide from Google</a> and <a href="http://www.vogella.com/tutorials/AndroidActionBar/article.html#menu_contextual_actionbar">this tutorial</a> to produce my own contextual action bar.</p>
  
  <pre><code>private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
  
      // Called when the action mode is created; startActionMode() was called
      @Override
      public boolean onCreateActionMode(ActionMode mode, Menu menu) {
          // Inflate a menu resource providing context menu items
          MenuInflater inflater = mode.getMenuInflater();
          inflater.inflate(R.menu.annotation_menu, menu);
          return true;
      }
  
      // Called each time the action mode is shown.
      // Always called after onCreateActionMode, but
      // may be called multiple times if the mode is invalidated.
      @Override
      public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
          return false; // Return false if nothing is done
      }
  
      // Called when the user selects a contextual menu item
      @Override
      public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
          switch (item.getItemId()) {
              case R.id.custom_button:
                  // do some stuff
                  break;
              case R.id.custom_button2:
                  // do some other stuff
                  break;
              default:
                  // This essentially acts as a catch statement
                  // If none of the other cases are true, return false
                  // because the action was not handled
                  return false;
          }
          finish(); // An action was handled, so close the CAB
          return true;
      }
  
      // Called when the user exits the action mode
      @Override
      public void onDestroyActionMode(ActionMode mode) {
          mActionMode = null;
      }
  };
  </code></pre>
  
  <p>This menu is designed to appear when the user selects text, so it overrides the native copy/paste menu. Now I get to my issue.</p>
  
  <p>Because I am overriding functions for text selection, I also added a <code>LongClickListener</code> to a <code>WebView</code> and implemented the <code>onLongClick(View v)</code> method so I can detect when users make the selection. </p>
  
  <pre><code>    myWebView.setOnLongClickListener(new View.OnLongClickListener() {
  
          @Override
          public boolean onLongClick(View v) {
              if (mActionMode != null) {
                  return false;
              }
  
              mActionMode = startActionMode(mActionModeCallback);
              v.setSelected(true);
              return true;
          }
      });
  </code></pre>
  
  <p>When I long click, I see my custom menu appear, but no text is highlighted.<br>I need to have the text selection functionality; without it, my menu is pointless.</p>
  
  <p>How do I override <code>onLongClick(View v)</code>, but maintain the text selection provided by Android?<br>If that is not possible, can I make the call to <code>startActionMode(mActionModeCallback)</code> somewhere else so that text will be selected as normal, but my custom menu will also appear?<br>If neither of those are possible... help.</p>