全部博文(788)
分类: 敏捷开发
2017-09-19 22:27:02
realm不支持hashmap这种形式
stackoverflow给出了解决方案
class MyData extends RealmObject { private RealmListmyMap; } class MyMap extends RealmObject { private String key; private MyClass value; }
但是我用gson解析时会报错
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2656 path $.layers[0].icons
因为map是一个对象,而private RealmList
应该怎样解析呢?