I've created a tablelayout which dynamically adds a table row by a click of a button. Each table row consists of three edittexts. Each edittext displays the contents time, activity and budget which are retrieved from a sqlite table. A new row can also be added. My question is: How can I update the sqlite table whenever a change is made in an edittext that is currently holding data from the sqlite table?
EDIT: For further information: I've programmatically created the three edittexts and the table row. So, this is the way I've been currently trying to do it. I've placed each edittext in its own list array in order to get the data from edittext. I'll show an example code of one of the edittext in the table row that holds the data time (e.g. 12:00):
String[] timesDatabase = new String[allEdsTimeDatabase.size()];
for(int i=0; i < allEdsTimeDatabase.size(); i++){
timesDatabase[i] = allEdsTimeDatabase.get(i).getText().toString();
timeItemsDatabase.add(timesDatabase[i]);
}
for (int i = 0; i < timeItemsDatabase.size(); i++){
updateTime = timeItemsDatabase.get(i).toString();
}
for (int i = 0; i < db.getActivityIDs().size(); i++){
plannerDatabase = new Planner(db.getActivityIDs2().get(i),updateTime,updateName,updateEx2,dateId,tripId2);
}
db.updateActivity(plannerDatabase);
If I have this: db.updateActivity(plannerDatabase); inside the loop then it overwrites/updates everything in the table to the same contents as the last row. If I have it outside it just updates the last row.