We have this default feature in android 3.0 that when we long press somewhere (say in a webview) action mode is started and as a result the action bar changes with many default features like copy, find etc.
Now what I want is that I want to start this action mode but not by long pressing on the web view. I want that when I load a webview I want this action mode automatically started without any long press. Is it possible ? Is there any method by which we can achieve this?
In case you still need it or other people are looking for it
startActionMode(mContentSelectionActionModeCallback);
And as callback use:
private ActionMode.Callback mContentSelectionActionModeCallback =
new ActionMode.Callback() {
public boolean onCreateActionMode(ActionMode actionMode, Menu menu)
{
//Here you can inflate a menu
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.name_menu, menu);
return true;
}
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
return false;
}
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem)
{
return false;
}
public void onDestroyActionMode(ActionMode actionMode) {
awesomeAdapter.overviewFragment.stopEdit();
}
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With