realm不支持hashmap这种形式
stackoverflow给出了解决方案
http://stackoverflow.com/ques...
class MyData extends RealmObject {
private RealmList<MyMap> myMap;
}
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<MyMap> myMap;是一个数组
应该怎样解析呢?
realm怎样支持hashmap >> android
这个答案描述的挺清楚的:
http://www.goodpm.net/postreply/android/1010000006766134/realm怎样支持hashmap.html