SQLite in Android


SQLite is available on every Android device. Using an SQLite database in Android does not require any database setup or administration. You only have to define the SQL statements for creating and updating the database. Afterwards the database is automatically managed for you by the Android platform. SQLite supports the following datatypes: SQLite itself does not validate if the types written to the columns are actually of the defined type, e.g. you can write an integer into a string column and vice versa. SQLite supports standard relational database features like SQL syntax, transactions, and prepared statements. In addition it requires only little memory at runtime (about 250 KB).

The Content Provider
An SQLite database is private to the application which creates it. If you want to share data with other applications, you can use a Content Provider. A content provider is a specialized type of data store that exposes standardized ways to retrieve and manipulate the stored data. To query a content provider, you provide a query string in the form of a URI, with an optional specifier for a particular row, using the following syntax:
   <standard_prefix>://<authority>/<data_path>/<id>
For example, to retrieve all the contacts stored by the Contacts application, the URI would look like this:
   content://contacts/people



      “We shall not cease from exploration    
      And the end of all our exploring    
      Will be to arrive where we started    
      And know the place for the first time.”    
      ― T. S. Eliot, Four Quartets