Example usage for android.app Activity startActionMode

List of usage examples for android.app Activity startActionMode

Introduction

In this page you can find the example usage for android.app Activity startActionMode.

Prototype

@Nullable
public ActionMode startActionMode(ActionMode.Callback callback) 

Source Link

Document

Start an action mode of the default type ActionMode#TYPE_PRIMARY .

Usage

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;
}