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
Merge two RealmResult #4301
Comments
Hi @DastanIqbal
Note, it can already be accomplished today using:
You would miss out on some of the |
@DastanIqbal You are looking for http://stackoverflow.com/a/34976540/2413303 (although he is missing the |
Realm Core does not provide this functionality currently. |
Thanks for the response guys. @cmelchior
Actually my first result1, Users based on status like new,ongoing in ascending order(by timestamp) and then result2, Users based on status like canceled,resolved in descending order(by timestamp). its means new,ongoing will be on top, and then others. and my RecylcerViews Adapter are total depend on RelamResult. so I can't use ArrayList for now. @Zhuinden Ya I am using @kneth Thanks kneth, but Can you consider this issue in future release build? |
You could conceivably implement this yourself, by creating a I won't rule out we can provide an implementation of this at one point, but it will unfortunately not have a high priority unless there is a big demand for it. |
k thanks @cmelchior let me try what you explained And realm is awesome. :) |
@cmelchior RealmResults is a final class, can't extend. |
It was made non-final in 2.2.2 |
@DastanIqbal no it's not since I think something like Realm But even then, you conveniently skipped this answer http://stackoverflow.com/a/34976540/2413303 |
@Zhuinden I checked that answer, but not helping, my adapter using RealmResult, cannot migrate to List. :( |
That statement is false. |
@cmelchior How do I access BaseRealm its local class, require in constructor |
Just created local package |
@DastanIqbal Any progress? I'm interested in what you were able to implement. |
I have a use case for this also; 'pinning' items to the top of an adapter. |
Hi @rscottcarson, I used Arraylist to combined the result as @cmelchior mentioned in above comment
and I used @Zhuinden link modified little for RealmAdapter
then after you can extend RealmMultiAdapter with your adapter.
after that same rule as you follow for other realm adapter. PS: I was expecting something else, but I compromised with this solution. |
EDITED according to @Zhuinden
|
I don't see why you would map them to a It would make more sense for it to be List<Project> projects = new ArrayList<>(user.getProjectsJoined().size() + user.getProjects().size()); |
You're absolutely right. I just did it that way because all of my adapters inherit from RealmAdapter, I know ArrayList is lighter... I am not even using auto update... otherwise it wouldn't have made any sense. |
Another use case: showing user search results, with any matching at the start showing first, and any matching anywhere in the word showing second. |
➤ Edwin Monk-Fromont commented: Another use case: showing user search results, with any matching at the start showing first, and any matching anywhere in the word showing second. |
Yes i have the same requirement, do we have any direct method available from realm other than the workarounds suggested by DastanIqbal commented on May 23, 2017 |
Goal
Expected Results
r=r1+r2
Actual Results
Steps & Code to Reproduce
Code Sample
Version of Realm and tooling
Realm version(s): ?
2.2.1
Realm sync feature enabled: yes/no
don't know
Android Studio version: ?
2.3
Which Android version and device: ?
6 Moto X Play
The text was updated successfully, but these errors were encountered: