我可以有字符串的ArrayList的境界对象的android [英] Can I have arrayList of string in realm object android

查看:197
本文介绍了我可以有字符串的ArrayList的境界对象的android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我们没有在领域中的任何列表数据类型,我们如何使用的ArrayList<串GT; 在一个领域对象的结果?
我有同样的问题为定制机型的ArrayList我们做即的ArrayList< CustomModel> 但我明白,我们首先用做相同的自定义模式RealmObject

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;
}

然后我可以使用

private RealmList<CustomObject> customObjectList; 

在另一RealmObject

in another RealmObject

做我必须做同样的用绳子的ArrayList的?结果
1.制作String对象结果
2.使用领域列出反对

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

推荐答案

是的,你必须手动打你的字符串在StringObject。我们希望增加对支持 RealmList&LT;弦乐&GT; RealmList&LT;整数GT; 等,但它是一个长长地出了。

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.

这篇关于我可以有字符串的ArrayList的境界对象的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆