codeman codeman - 1 year ago 173
Java Question

Realm java sort with multiple fields

I'm sorting like this:

RealmResults<Show> shows = realm.where(Show.class).findAll();
shows.sort("venueTitle", RealmResults.SORT_ORDER_ASCENDING);

How can I sort by multiple properties? Adding another sort line just resets the order of the results entirely.

Answer Source

Looks like they just added this in 0.77. I was using 0.76. Here's the Github issue:

and here's the API reference:

public void sort(java.lang.String[] fieldNames,
    boolean[] sortAscending)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download