List of usage examples for android.app Activity startActionMode
@Nullable
public ActionMode startActionMode(ActionMode.Callback callback)
From source file:bbct.android.common.activity.BaseballCardList.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.card_list, container, false); ButterKnife.bind(this, view); final Activity activity = Objects.requireNonNull(getActivity()); View headerView = new HeaderView(this.getActivity()); CheckBox selectAll = headerView.findViewById(R.id.select_all); selectAll.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override// ww w.j a v a2 s . co m public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked && !mCallbacks.isStarted()) { activity.startActionMode(mCallbacks); } else if (mCallbacks.isStarted()) { mCallbacks.finish(); } BaseballCardList.this.setAllChecked(isChecked); } }); listView.addHeaderView(headerView); applyFilter(filterParams); return view; }