sqlite - Android convert array of months -
i array of months since sqlite database, want see months in chart achartengine long name. how i?
string sql = "select strftime('%m',"+table.date+") month"; cursor c = db.rawquery(sql, null); int count = c.getcount(); string[] months= new string[count]; for(int i=0; i<count; i++) { c.movetonext(); months[i] = c.getstring(0); } for(int i=0;i<months.length;i++){ multirenderer.addxtextlabel(i+1, months[i]); }
timezone timezone = timezone.getdefault(); calendar calendar = new gregoriancalendar(timezone); for(int i=0;i<months.length;i++){ int monthnumber=integer.valueof(months[i])-1; calendar.set(2014, monthnumber, 1, 1, 1, 1); string monthname=calendar.getdisplayname(calendar.month, calendar.long, locale.getdefault()); multirenderer.addxtextlabel(i+1, monthname); }
Comments
Post a Comment