Jacob Ferrero Jacob Ferrero - 5 months ago 20
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?


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.