-2
목록의 일부 항목을 업데이트하고 싶습니다. 그것은 잘 작동하고 또한 데이터베이스 행이 작업을 수행하고 싶습니다. 오류가 없지만 응용 프로그램을 다시 시작한 후에 오래된 데이터가 있기 때문에 쿼리가 작동하지 않습니다. 뭐가 잘못 되었 니? 클래스에서데이터베이스가 업데이트되지 않습니다.
if(!done)
{
list.get(longPressedPossition).setRating(tmpBundleIntent.getInt("nowaOcena"));
list.get(longPressedPossition).setNameOfItem(tmpBundleIntent.getString("nowaNazwa"));
dataBaseManager.updateTodo(list.get(longPressedPossition));
adapter.notifyDataSetChanged();
done = true;
}
그리고 방법 :
public void updateTodo(GifModel model) {
String where = SqliteHelper.NAME + "=" +"'"+ model.getNameOfIteme()+ "'";
ContentValues updateTodoValues = new ContentValues();
updateTodoValues.put(SqliteHelper.NAME, model.getNameOfIteme());
updateTodoValues.put(SqliteHelper.RATING, model.getRating());
database.update(SqliteHelper.TABLE_NAME, updateTodoValues, where, null);
}
답장을 보내 주셔서 감사합니다. 네, 지금 저는 바보 같은 실수를 저질렀습니다. 다시 감사합니다. – Darek