How we can store java list in realm android database. I try to store it by using setter method present in my model, but it doesn\'t work and I get \"Each element of \'value\' mu
Replace code with
public void storeNewsList(String categoryId, List newsList) {
try(Realm realm = Realm.getDefaultInstance()) {
realm.executeTransaction(new Realm.Transaction() {
@Override
public void execute(Realm realm) {
NewsList newsListObj = new NewsList(); // <-- create unmanaged
RealmList _newsList = new RealmList<>();
_newsList.addAll(newsList);
newsListObj.setNewsList(_newsList);
newsListObj.setCategoryId(categoryId);
realm.insert(newsListObj); // <-- insert unmanaged to Realm
}
});
}
}