Realm query for latest record for each user

Tags: java realm
By : Michael
Source: Stackoverflow.com
Question!

How would I accomplish a similar query in realm java like that one asked in this question: how do I query sql for a latest record date for each user Cause it seems realm lacks a group by method when fetching queries

Here's my RealmObject:

public class Memo extends RealmObject {
    @Ignore
    public static final int SENT = 1;
    @Ignore
    public static final int UNREAD = 2;
    @Ignore
    public static final int READ = 3;
    @Ignore
    public static final int PENDING = 4;
    private static final String TAG = Memo.class.getName();
    @PrimaryKey
    public String id = "";
    @Index
    public String connection = "";
    public String subject = "";
    public String body = "";
    public int status = 0;
    public Date date;
    public Boolean sentByMe = false;
    public String remoteId = "";
    public Boolean isFile = false;
    public String filepath = "";
}

This represents the user:

public String connection
By : Michael


Answers
Sign up using Google



This video can help you solving your question :)
By: admin