Adding features to Clipboard ActionBar
In my app, I want to be able to start my own function when user copy a text to the clipboard.
I'm overridin开发者_如何学JAVAg function onActionModeFinished and as I want to be sure user tapped on Copy I'm getting selected navigation index. Unfortunately if always return -1. Is there something I'm doing wrong here ?
@Override
public void onActionModeFinished(ActionMode mode) {
super.onActionModeFinished(mode);
if (_actionBar != null) {
int index = _actionBar.getSelectedNavigationIndex();
// here index is always -1
}
}
ActionBar can contain tabs and list selector on the left side. So, getSelectedNavigationIndex is used to get the position in this navigation items not in the menu items located in the right side.
精彩评论