How convert from List to RealmList<RelmInt>?
See original GitHub issueMy model:
public class Company extends RealmObject {
@PrimaryKey
private long id;
private RealmList<RealmInt> favorIds;
private String address;
private String email;
}
public class RealmInt extends RealmObject {
private int value;
}
In Realm in field favorIds I has the next values:
[10, 20, 30]
And I need to update favorIds with [10,20,30,40] in Realm:
My steps:
- Delete favorIds
- add update list
Here code:
realm.executeTransaction(new Realm.Transaction() {
@Override
public void execute(Realm realm) {
List<Integer> favorsIds = CompanyService.getFavoritesIds(selectedCompanyID);
favorsIds.add(40);
Company company = realm.createObject(Company.class);
company.getFavors().deleteAllFromRealm();
company.getFavors().addAll(favorsIds);
}
});
But I get compile error when try to add List<Integer> to RelmList<RealmInt>:
Cannot resolve method "addAll(java.util.List<java.lang.Integer>)"
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
How to convert realm list to RealmResults<Object>?
Solution: if you want to query on top of a RealmList, it should belong to a managed RealmObject, returned by a Realm instance....
Read more >RealmList (Realm 10.10.1) - MongoDB
Returns true if the list contains the specified element when attached to a Realm. This method will query the native Realm underlying storage...
Read more >Untitled
Sukkeleir, A list actors and actresses 2014, Top ten richest school districts in ... Bruchus lentis, Fiesta de santiago de huata 2013, Son-in-law...
Read more >Untitled
Leonard nimoy big bang theory imdb, Los pacaminos, List three supreme court ... Ncaa 6th man of the year 2015, Pascal n/mm2 converter,...
Read more >Untitled
Endeavour cast list home, Content based image retrieval using color and texture, ... 16 belmont avenue belfast, La nina julion alvarez free download!...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@lmdic one day you should tell me how you ended up with such a terrible Realm schema, just to sate my curiosity 😛
Of course, as it is a
RealmInt, you need to construct a managedRealmIntand add that into thefavorIdsmanaged list@lmdic welp,
RealmList<Integer>should be available in about 2 weeks