![setting up sqlite database android setting up sqlite database android](https://i.pinimg.com/564x/54/42/5b/54425b88285e99b48d9d5444db570d85.jpg)
We define a DBManager class to perform all database CRUD(Create, Read, Update and Delete) operations. Hence we can figure out the best way to convert the database from the old schema to the new one.
![setting up sqlite database android setting up sqlite database android](https://windows-cdn.softpedia.com/screenshots/SQLite-Viewer_1.png)
Constructor : This takes the Context (e.g., an Activity), the name of the database, an optional cursor factory (we’ll discuss this later), and an integer representing the version of the database schema you are using (typically starting from 1 and increment later).For that we’ll need to create a custom subclass of SQLiteOpenHelper implementing at least the following three methods. SQLiteOpenHelper wraps up these logic to create and upgrade a database as per our specifications. Call createDatabase () method in your MainActivity (which is first in your app, launcher activity). We will have option to alter the database schema to match the needs of the rest of the app. Create database in SQLite browser (like SQLite Maestro), copy your database in assets folder in your project.
![setting up sqlite database android setting up sqlite database android](https://parallelcodes.com/wp-content/uploads/2021/03/android-sqlite-database-add-data-example-930x620.jpg)