Database
A database is the best option to store structured data. Android provides support for SQLite using the android.database.sqlite
package. This database is a part of the Android stack and the system administers the database. Using SQLite for mobile operating systems is a prudent choice as it is small and requires no setup or administration. And it is free!
Once created, the database files are sandboxed with the application and are stored in the /data/data/<application-path>/databases/
directory. This private database will be accessible to all the components of the application but not outside the application.
The following code snippet shows how to create a database that resides on the internal memory. The class will extend the SQLiteOpenHelper
class and uses the SQL (Structured Query Language) CREATE_TABLE
clause. The table stores a list of books that the user marks as a wish list. There are two columns in our table wishlist
, a column ID that auto increments and the name of the...