title: How to correctly handle action mode "done" button?
body: <blockquote>
  <p><strong>Possible Duplicate:</strong><br />
  <a href="https://stackoverflow.com/questions/6162595/how-to-invoke-the-actionbars-contextmenu-like-behavior">How to invoke the ActionBar's ContextMenu-like behavior?</a><br>
  <a href="https://stackoverflow.com/questions/11642877/how-to-recognize-whether-the-done-button-is-clicked-in-actionmode">How to recognize whether the Done button is clicked in ActionMode</a></p>
  </blockquote>
  
  <p>How to correctly handle action mode &quot;done&quot; button?</p>
  <p><img src="https://i.stack.imgur.com/LZQhS.png" alt="Action mode done button" /></p>
  <p>I perform some operations on an object in the action mode and I want to save the result by click on this button -  like &quot;save and exit&quot;.
  How can I dispatch key-press on this button?</p>
  <p>The only the way I see is to override onDestroyActionMode(ActionMode mode) method with flags, triggered in dispatchKeyEvent(KeyEvent event) to handle if it was caused by &quot;back&quot; button press.</p>
  <p>Logcat:</p>
  <p>&quot;Done&quot; pressed</p>
  <pre><code>10-03 14:31:58.211: D/DESTROY(967): onDestroyActionMode  
  </code></pre>
  <p>&quot;Back&quot; pressed</p>
  <pre><code>10-03 14:32:01.771: D/DISPATCH(967):   Action: 0/n  Keykode: 4  
  10-03 14:32:01.911: D/DISPATCH(967):   Action: 1/n  Keykode: 4  
  10-03 14:32:01.911: D/DESTROY(967): onDestroyActionMode
  </code></pre>
  <p>But it is not look like good practice.
  Is there any &quot;nice&quot; solution?</p>
  <p><strong>UPD: I know how to invoke action mode and handle action item events in ActionMode.Callback, but how i can catch &quot;Done&quot; button press to modify it's behavior?</strong> &quot;Back&quot; button and &quot;Done&quot; button both leads to <code>ActionMode.Callback</code>'s <code>onDestroyActionMode()</code> call.</p>