Welcome to the Mobikul blog how to manage the data in Offline mode(means no network connection).
There are some methods to store the data in offline. Like sharedPrefrences and Database.
But in this blog, we have going to show how to use a database using SQLite.
There is also a blog on the SQLite database previous blog.
Ok, if you read the previous blog then you have been got the knowledge about the SQLite basics like how to create the data and insert data into it.
How to update the data in particular row
First of all, create the ContentValues object:
123 ContentValues cVObj = new ContentValues();cVObj.put("Name","Aman");cVObj.put("Age","23");
Then simply use the update method:
1 myDB.update(TableName, cVObj, "empId="+id, null);
That column will be updated.
How to delete the particular row
It is very simple,
1234 try {myDB.delete(TABLE_NAME, "empId="+Id, null);}catch(Exception e) { ... }
Thanks for reading this blog.
Be updated, Stay Super.