Skip to content

Multi Sort Form Cell

The MultiSort form cell allows users to choose multiple sorting options from a list of predefined options. It also allows users to reorder the selected options by dragging and repositioning them.


Like other form cells MultiSort form cells include support for validation by adding a key (label), as well as error or helper text.

Using the MultiSort Form Cell

You can use the MultiSort form cell within your activity like any traditional Android view:

        app:key="MULTIPLE SORT"
        ... />

Editable and Non-Editable Modes

The MultiSort form cell "editable" flag works the same as "android:enabled". An editable cell is enabled.

Error and Helper Texts

To set the error and helper text on the view, enable the feature on the view by calling setErrorEnabled and setHelperEnabled respectively. You can also use the app:errorEnabled and app:helperEnabled XML attributes to enable the support for these features.

Once enabled, you can call setError(CharSequence) to set the error text and setHelperText to set the helper text. Once set, the error/helper text remains enabled until setErrorEnabled(false)/setHelperEnabled(false) is called.


Set Value Options and Value on the Cell

The MultiSort form cell presents a list of options (value options) to choose from. Use the public void setValueOptions(@NonNull List<String> valueOptions) method on the cell. Options are given as a list of strings. You can also use the android:entries="@array/multiSortValueOptions" XML attribute to set value options on the cell.

Once any option is chosen by the end user, that option is added to the value of the cell. You can configure the cell value by calling public void setValue(@Nullable List<String> value) or by using the android:value="@array/multiSortValue" XML attribute.

    multisort.value = multiSortPreSelected


The MultiSort form cell allows end users to reorder the cell values by dragging the options with the handle. Reordering is only performed for selected values and unselected value options can not be reordered or dragged.


Callbacks for Value Changes

The MultiSort form cell supports callback listeners, such as OnCellChangeListener<List<String>>, to notify the application of changes to the selected choice.

The OnCellChangeListener<List<String>> callback is called whenever a value option is selected by the user:

multisort.cellValueChangeListener = object : FormCell.CellValueChangeListener<List<String>>() {
            override fun cellChangeHandler(value: List<String>?) {
                multisort.isErrorEnabled = value?.isEmpty() != false
                if (value?.isEmpty() != false) {
                    multisort.error = "You must provide one sorting criteria"

Last update: August 12, 2020