Jacob Ferrero Jacob Ferrero - 1 year ago 83
Android Question

Realm - How to build a feed with multiple types of objects?

I'm trying to use Realm to build a feed for my app. I want the feed to include everything new: posts, comments, events, and other things I have in my app.

I have these all defined as POJOs that extend

, and they all have a
property, however I can't find a way to query the whole Realm for objects sorted by their
. Is there any way to do that?

Answer Source

Unfortunately realm does not support polymophism/inheritance in realm objects. You can easily loop through each data set and merge them together according to createdAt. Using DynamicRealm this can be easily done.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download