Recently I’ve been working on getting the Android calendar to integrate with Zadatak. The operating systems keeps its calendar data in a database and access is provided through the CalendarContract classes. CalendarContract.Events is the table that we’re using to get all the user’s event. The algorithm works by finding the day with the most free time between now and the task’s due date. In my original testing of the algorithm I was doing that by simply iterating over every day between now and the due date. However now that we have a database of events instead of them being stored in memory, the number of times you access the database becomes a consideration. A solution I am currently in the midst of implementing is polling the database once a day and loading the next month into memory as a snapshot. This way both memory and database calls are taken into consideration. The snapshot is taken once a day and then is adjusted as tasks are scheduled into certain days. Next week I’ll be working on scheduling tasks and placing them back into the android calendar.