android - Realm database, add a arraylist of objects as a column for a class -


i worked migration far, using example realm. , adding simple column like:

table persontable = realm.gettable(trip.class); long vehicleindex = persontable.addcolumn(columntype.string, "vehicle"); 

but need add arraylist 1 object:

 private arraylist<stopinfo> filteredlocations = new arraylist<>(); 

how can rezolve migration?

first, in realm, if want have list field, realmlist thing use. see doc.

second, add realmlist in migration:

assume have realmlist<stopinfo> defined in model class

private realmlist<stopinfo> stopinfolist; 

to add in migration:

// in migration // create realmlist field long listindex = table.addcolumnlink(columntype.link_list,     "stopinfolist", transaction.gettable("class_stopinfo")); 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -