I do not recommend using this method:
public void updateRow(long rowId, String code, String name) { ContentValues args = new ContentValues(); args.put("code", code); args.put("name", name); db.update(DATABASE_TABLE, args, "_id=" + rowId, null); }
Your application will be vulnerable to SQL injection, the best way to do it is something like this:
public void updateRow(long rowId, String code, String name) { ContentValues args = new ContentValues(); args.put("code", code); args.put("name", name); String whereArgs[] = new String[1]; whereArgs[0] = "" + rowId; db.update(DATABASE_TABLE, args, "_id= ?", whereArgs); }
Jodson leandro
source share