Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force order of Section #10

Open
ghost opened this issue Dec 16, 2014 · 1 comment
Open

Force order of Section #10

ghost opened this issue Dec 16, 2014 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 16, 2014

Hi sir, excuse my ignorance. But is there a way to force the order of the sections?

For example: I have a list of schedules (listview items) and I would like to sort them by priority "Urgent", "Normal", "discriminable", "Semi Urgent". This is simple. but as I'm doing, guiding me with the example, it order the sections alphabetically as this: "discriminable", "Normal", "Semi Urgent", "Urgent" .

But I do not want to list it alphabetically, nor decreasing, I want to do it by my own order, for example: "Urgent", "Semi Urgent", "Normal", "discriminable"...

UPDATE: Actually, I want to know if it is possible order the sections in these ways...

  1. Ascendant
  2. Descendant
  3. My own order.
@nolanlawson
Copy link
Owner

Yes, you can set the sorting of the sections using

.sortKeys(new Comparator<CharSequence>(){...})

Then you implement whatever sorting you want within that Comparator.

In this case "keys" refers to section titles and "values" refers to section contents; I really didn't choose great names. 😛

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant