我想在API 8中使用ActionMode.Callback。我尝试将startActionMode更改为startSupportActionMode等,但它仍然无效。错误为Cannot resolve method 'startSupportActionMode(android.view.ActionMode.CallBack)'
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getListView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
getActivity().startSupportActionMode(modeCallBack);
return true;
}
});
}
private ActionMode.Callback modeCallBack = new ActionMode.Callback() {
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
mode.setTitle("Options");
mode.getMenuInflater().inflate(R.menu.menu_msg, menu);
return true;
}
...
};