自从我的SQLite数据库以来,我得到了几个月的数组,现在我想在图表中看到aChartEngine的长名称。我怎么样?
String sql = "SELECT strftime('%m',"+Table.DATE+") AS 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]);
}
答案 0 :(得分:1)
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);
}