android - Converting milliseconds to date -
i trying save time in milliseconds in database text.
long time= system.currenttimemillis() after trying retrieve , convert date this:
sqlitedatabase db = dbhelper.getwritabledatabase(); cursor c = db.query("movementtable", null, null, null, null, null, null); string str = "";  long = c.getlong(0);  if (c.movetofirst()) {     {         if (!c.getstring(6).equals("0"))         str = str + c.getlong(0) + " - " +c.getlong(1) + checkpoint(new latlng(c.getdouble(2),c.getdouble(3)))                 + " " + checkpoint(new latlng(c.getdouble(4),c.getdouble(5))) + " " + c.getstring(6) + "\n";     } while (c.movetonext()); } c.close();  text.settext(str); dbhelper.close(); code crashes trying initialize "a". without it, works.  in string result is:   1433064363251 - 14330643544443  doing wrong? please help. thanx in advance.
movetofirst method should first, can access cursor values.
if (c.movetofirst()) {     long = c.getlong(0);     {         if (!c.getstring(6).equals("0"))         str = str + c.getlong(0) + " - " +c.getlong(1) + checkpoint(new latlng(c.getdouble(2),c.getdouble(3)))                 + " " + checkpoint(new latlng(c.getdouble(4),c.getdouble(5))) + " " + c.getstring(6) + "\n";     } while (c.movetonext()); } c.close(); 
Comments
Post a Comment