android - Retrieve todays data from an online database -


i new kinvey , want result online database stored today , want application keep on refreshing every 10 seconds.

at moment can result online database , display in simple form, here code.

public void getdata(string sensorid){             asyncappdata<sensor> mysensors = myjavaclient.appdata("tdsensordata", sensor.class);         mysensors.getentity("5514e7c06356be824801c207",new kinveyclientcallback<sensor>(){              @override             public void onfailure(throwable arg0) {                  toast.maketext(getapplicationcontext(),arg0.getmessage(),toast.length_long).show();             }              @override             public void onsuccess(sensor sensor) {                  string times = sensor.getdatetime();                 system.out.print(times);                   float f1 = float.parsefloat(sensor.getsensorr1());                               string sens1 = float.tostring(f1);                               senso1.settext(sens1);                  float f2 = float.parsefloat(sensor.getsensorr2());                               string sens2 = float.tostring(f2);                 senso2.settext(sens2);                  float f3 = float.parsefloat(sensor.getsensorr3());                               string sens3 = float.tostring(f3);                 senso3.settext(sens3);                  temper.settext(sensor.gettemp()+ " " + "°c");              }          });     } 

and here , set class

public class sensor extends genericjson{      @key("_id")     private string id;      @key("datetime")     private string datetime;      @key("mac")     private string mac;      @key("sensor_1")     private string sensorr1;      @key("sensor_2")     private string sensorr2;      @key("sensor_3")     private string sensorr3;      @key("sensor_4")     private string sensorr4;      @key("temp")     private string temp;      @key("bat")     private string bat;       public string getid() {         return id;     }        public void setid(string id) {         this.id = id;     }        public string getdatetime() {         return datetime;     }        public void setdatetime(string datetime) {         this.datetime = datetime;     }        public string getmac() {         return mac;     }        public void setmac(string mac) {         this.mac = mac;     }        public string getsensorr1() {         return sensorr1;     }        public void setsensorr1(string sensorr1) {         this.sensorr1 = sensorr1;     }        public string getsensorr2() {         return sensorr2;     }        public void setsensorr2(string sensorr2) {         this.sensorr2 = sensorr2;     }        public string getsensorr3() {         return sensorr3;     }        public void setsensorr3(string sensorr3) {         this.sensorr3 = sensorr3;     }        public string getsensorr4() {         return sensorr4;     }        public void setsensorr4(string sensorr4) {         this.sensorr4 = sensorr4;     }        public string gettemp() {         return temp;     }        public void settemp(string temp) {         this.temp = temp;     }        public string getbat() {         return bat;     }        public void setbat(string bat) {         this.bat = bat;     }       public sensor() {         // todo auto-generated constructor stub     } } 

here example of data online database.

{"_id":"51a71254d06fdbee04000653","datetime":"2013-05-23t11:16:34z","mac":"0013a200407e0086","sensor_1":"91.19","sensor_2":"19.093333333333334","sensor_3":"439.3097042968143","sensor_4":"0.0","temp":"-17","bat":"47","_acl":{"creator":"kid_vpuam4pfqf"},"_kmd":{"lmt":"2013-05-30t08:48:20.335z","ect":"2013-05-30t08:48:20.335z"}},{"_id":"51a71255d06fdbee04000654","datetime":"2013-05-23t11:17:33z","mac":"0013a200407e0086","sensor_1":"91.19","sensor_2":"19.093333333333334","sensor_3":"494.4776331634671","sensor_4":"0.0","temp":"-17","bat":"47","_acl": 

will appreciate help.

check link

it has example like

 date.compareto()  date.before(), date.after() , date.equals() calender.before(), calender.after() , calender.equals() 

[http://www.mkyong.com/java/how-to-compare-dates-in-java/][1]


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -