Database

The NotePad database is created with the following SQL statement:

CREATE TABLE notes (

_id INTEGER PRIMARY KEY, title TEXT, note TEXT, created INTEGER, modified INTEGER

The _id column is not required, but recommended by the Android SDK documentation. The documentation suggests that the column should be defined with the SQL attributes INTEGER PRIMARY KEY AUTOINCREMENT. Unless you have an application-specific identifier that you can guarantee to be unique, you might as well make use of the AUTOINCREMENT feature to assign arbitrary integers robustly.

The title and note columns store the note title and note body data, respectively. The main raison d'ĂȘtre for the NotePad application is to manipulate the contents of these columns.

Finally, the created and modified columns keep track of when the note was created and when it was last modified. In the NotePad application itself, these columns are never seen by the user. However, other applications can read them using the content provider API.

0 0

Post a comment