The first thing you need to do is create a task. To do that, you need to insert a record. After that, you need to list the task(s) on the ReminderListActivity, which in turn allows you to tap a task to edit it, or long-press a task to delete it. These user interactions describe the create, read, update, and delete operations for your Task Reminder application. The next few sections show you how to add this functionality.
Inserting tasks into the SQLite database is a fairly easy process after you get the hang of it. In general terms, you simply follow these steps:
By learning how to insert your first task, you should get a good enough grasp on the SQLiteDatabase class interaction to perform the other necessary tasks. Therefore, in this section I introduce you to the entire implementation of RemindersDbAdapter, which outlines all the CRUD operations. Afterwards, I describe the CRUD tasks in greater detail.
When the user creates a task, it takes place in the ReminderEditActivity. To create the task, you need to create a class-level RemindersDbAdapter variable that is instantiated in the onCreate() method. After it is instantiated, you open the database with a call to the RemindersDbAdapter ...