I have the following classes for two models:
public class A extends RealmObject {
private String field1;
private B field2;
//getters and setters
//...
}
public class B extends RealmObject {
private String field3;
private Date field4;
//getters and setters
//...
}
I am receiving the following JSON that corresponds to the models:
{
"field1" : "hi",
"field2" : {
"field3" : "hi again",
"field4" : "2015-02-17T00:00:00"
}
}
I am trying to create an A object from the JSON, using createObjectFromJson(A.class, jsonString)
, but I am getting an exception java.lang.NumberFormatException: Invalid long: "2015-02-17T00:00:00"
.
It seems that realm is considering the date as a long
instead of a String
. Is there a way to set some kind of date format?