First of all, we will create SQLite database instance and then we are going to create an instance of content value. Step 4) Now in here what we’re going to do is, as we have done inserting data function. Because our table will contain four columns, id, name, surname and marks right. The First argument we are going to pass here will be string id, second is string name, third is string surname and fourth is string marks.īasically, we want to pass all the four column data to it. So it will be public and it'll return boolean and It's going to take four arguments. Now we will create one more function here and we will call it as updateData. javafile and in here till now we have created insert data and get all data function right. javaclass which we have created in the last tutorial so go to the database helper. Step 3) Now we need to create a function in our database helper. And to update the data we need a unique reference of the row so that we can tell SQLite that we want to delete the data from this row.īecause names can be same so if you want to change the name of one partner which shares the name with the other person then the data can be changed for both the names if you don't know what is the unique you know row or unique column in this, So id we have defined as a unique column for this database table. First one was id, the second one was name, surname and the marks scored by the students. Step 2) And one more thing we want to do is, if you remember our database table contains four columns. Step 1) First add one more button and this button we are going to use to update the data, so I'm going to change the name of the button as an update. Please follow the below steps in order to update data in SQLite database using our Android app:
0 Comments
Leave a Reply. |