With this query I select the month in the database. The cursor returns the exact month, but when I do the conversion to display the full name appears the following month. For example, the cursor returns 6, instead the method returns getDisplayName July.
SQLiteDatabase db = new DatabaseHelper(getActivity()).getReadableDatabase();
String sql = "SELECT DISTINCT strftime('%m',"+Table.DATA+") FROM "+Table.TABLE_NAME;
Cursor c = db.rawQuery(sql, null);
while (c.moveToNext()){
int monthNumero = (c.getInt(0));
Calendar ca = Calendar.getInstance();
ca.set(Calendar.MONTH, monthNumero);
String monthName = ca.getDisplayName
(Calendar.MONTH, Calendar.LONG, Locale.getDefault()).toUpperCase();
result1.add(monthName);
}
db.close();