Android – SQLite insert, delete and tip

Android – SQLite insert, delete and tip

You can read about SQLiteOpenHelper here. insert To insert a record in a table you need: a set of values using ContentValues class the table name delete To delete a record from a table you need: the table name selection string selection arguments array Tip It is not recommended to execute any database operation on the Main/UI thread. So use AsyncTask, override the doInBackground method and execute the database operations. THE END!!! Android – SQLite insert, delete and tip

Android – SQLite insert, delete and tip Read More

Android – SQLite update

Android – SQLite update

If you haven’t created yet SQLite helper class that extends SQLiteOpenHelper read this post. To update an existing record/row in SQLite table you need: table name column names that will be updates the new column values selection criteria I will first create a method that has 3 parameters, SQLiteDatabase, an id and an object that has all the values to be updated: Next, I will use ContentValues class to store a set of values so later used with update: Now create one string for the selection and one string array…

Android – SQLite update Read More

Android – SQLite and SQLiteOpenHelper class

Android – SQLite and SQLiteOpenHelper class

SQLite provides a structured data storage and it is lightweight and run-in process, which means the library runs as part of the application. There is no need for server installation and configuration. SQLite has 5 datatypes: TEXT NUMERIC INTEGER REAL BLOB You can read more here. SQLiteOpenHelper class SQLiteOpenHelper class provides methods to access, manage the creation and version management of the database. To create an SQLiteOpenHelper class, create a new Java class file. The class should extend the SQLiteOpenHelper class. Press Alt + Enter and select Implement Methods. Click…

Android – SQLite and SQLiteOpenHelper class Read More