Since you are using the
Toolbar
, I also assume you are using the
AppCompatActivity
and have replaced the built inActionBar
with
your customToolbar
usingsetSupportActionBar(toolbar);
First of all ensure you are importing the correct namespace:
import androidx.appcompat.view.ActionMode;
// Or
import android.support.v7.view.ActionMode;
and NOT
import android.view.ActionMode;
then use
_actionMode = startSupportActionMode(this);
and NOT
_actionMode = startActionMode(this);