I use ActionMode
to select items in a grid. The problem is that I cannot recognize whether exactly the Done button is clicked. The only I can is to know that ActionMode
is finished. But pressing Back finishes the ActionMode
too.
The desired behavior is to accept selection on Done click, and exit ActionMode
on Back press.
I tried to use ActionMode.setCustomView()
but it doesn't affect the Done button. The Activity.onBackPressed()
is not called when ActionMode is started.
The one solution I've found is to use ActionBarSherlock and get the Done button manually:
View closeButton = findViewById(R.id.abs__action_mode_close_button);
But it works on Android 2.x-3.x only, because on 4.x a native action bar is used.