android - Loopback + AndroidSDK: Retrieving Date fields -


i have working loopback api running backend android app. i'm using mysql save data. tables have @ least 1 datetime field. of course, need retrieve them.

using api explorer correctly these datetime fields:

    {         "id": 1,         ...         "dtdateadded": "2014-06-10t16:42:36.000z",         "dtlastmodified": "2014-10-01t00:00:00.000z"     } 

so date fields correctly retrieved db.

but when retrieve data android app, date fields null.

this model definition:

public class mymodel extends model {      private int id;     private date dtlastmodified;      public int getid() {         return id;     }      public void setid(int id) {         this.id = id;     }      public date getdtlastmodified() {         return dtlastmodified;     }      public void setdtlastmodified(date dtlastmodified) {         this.dtlastmodified = dtlastmodified;     } } 

the code retrieve data:

repository.findall(new listcallback<mymodel>() {      @override     public void onsuccess(list<mymodel> list) {         (int = 0; < list.size(); i++) {             mymodel objrest = list.get(i);             log.i("tour id", objrest.getid() + "last modified: " + objrest.getdtlastmodified());         }     } } 

the log outputs id field correctly date field null.

the loopback android sdk not support "advanced" data types.

dates represented strings in json: "2015-03-24t18:00:09.975z". need create setter accepts string , converts (probably using external date/time library).


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -