Last active
December 17, 2015 01:39
-
-
Save quanturium/5529738 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected SortedMap<Integer, Object> initializeSections(Cursor c) | |
{ | |
TreeMap<Integer, Object> sections = new TreeMap<Integer, Object>(); | |
int offset = 0, i = 0; | |
while (c.moveToNext()) | |
{ | |
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
String eventDate = sdf.format(new Date((long) c.getInt(c.getColumnIndex(EventsDatabase.COL_FROM_DATE)) * 1000)); | |
if (!sections.containsValue(eventDate)) | |
{ | |
sections.put(offset + i, eventDate); | |
offset++; | |
} | |
i++; | |
} | |
return sections; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment