Skip to content

Sorting

Mukesh Solanki edited this page Sep 1, 2018 · 1 revision

Country Picker allows you to change the order of the counties listed. To sort the list you need to provide the sort type to the builder by calling sortBy(). Below is a snippet of how to apply sort.

CountryPicker.Builder builder =
        new CountryPicker.Builder().with(Context)
            .listener(OnCountryPickerListener).sortBy(SORT_TYPE);

We can sort the library in 3 different ways.

Sort by Name

As the name suggests this will sort the list in alphabetic order. To apply this sorting technique pass CountryPicker.SORT_BY_NAME to sortBy() in the builder.

Sort by ISO

As the name suggests this will sort the list by ISO. To apply this sorting technique pass CountryPicker.SORT_BY_ISO to sortBy() in the builder.

Sort by Dial Code

As the name suggests this will sort the list by Dial Code. To apply this sorting technique pass CountryPicker.SORT_BY_DIAL_CODE to sortBy() in the builder.

You can’t perform that action at this time.