Modifying the Database

Android Cursors are great when you want to read data from the database, but the Cursors API does not provide methods for creating, updating, or deleting data. The SQLiteDatabase class provides two basic interfaces that you can use for both reading and writing:

• A set of four methods called simply insert, query, update, and delete

• A more general execSQL method that takes any SQL statement and runs it against the database

We recommend using the first method when your operations fit its capabilities. We'll show you both ways using the MJAndroid operations.

0 0

Post a comment