| Start |
|---|
| onUpgrade() method
In this class, the |
| Reading data from a Cursor Here is an example of a method that would live inside a First, define the Then, define the method that will query the database, and return a |
Using the SQLiteOpenHelper class |
Insert data into database |
| Bulk insert Here is an example of inserting large chunks of data at once. All the data you want to insert is gathered inside of a ContentValues array. And here is an example of how to use it: |
| Create a Contract, Helper and Provider for SQLite in Android DBContract.java DBHelper.java DBProvider.java How to Use: |
Updating a row in a table |
| Performing a Transaction Transactions can be used to make multiple changes to the database atomically. Any normal transaction follows this pattern: Calling |
| Delete row(s) from the table To delete all rows from the table To delete all rows from the table and get the count of the deleted row in return value To delete row(s) with |
| Create Database from assets folder Put your dbname.sqlite or dbname.db file in assets folder of your project. Here is How you can access database object to your activity. Then in onCreate Method initialize it and call createDatabase() Method as show below. Perform all of your insert, update, delete and select operation as shown below. |
| Store image into SQLite Setting Up the database Insert in the Database: Retrieving data: Note:
Below is an Utility class which I hope could help you: |
| Exporting and importing a database You might want to import and export your database for bacukups for example. Dont forget about the permissions. RemarksThe |
Read Article
https://develop.horje.com/learn/1434/reference