Can I have arrayList of string in realm object android

Salmaan picture Salmaan · May 15, 2015 · Viewed 16.7k times · Source

As we dont have any list data type in realm, how can we use ArrayList<String> in a realm object?
I had same question for the arrayLists of the custom models we make i.e. ArrayList<CustomModel> but for that I understand that we first have to make RealmObject of same Custom model using

public class CustomObject extends RealmObject {
    private String name;
    private String age;
}

and then I can use

private RealmList<CustomObject> customObjectList; 

in another RealmObject

Do i have to do same with arrayList of string?
1. Making String object
2. Use that object in Realm List

Answer

Thomas Goyne picture Thomas Goyne · May 15, 2015

Yes, you have to manually box your strings in a StringObject. We'd like to add support for RealmList<String>, RealmList<Integer>, etc., but it's a long way out.