I have a problem with updating an item in RecycleView.
When i try to edit a dream object and save it then it gets updated in database but not in the list of dream
and I don't know why.
This method creates and updates a dream object.
@OnClick({R.id.addTagDream, R.id.saveDreamButton})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.addTagDream:
Intent intent = new Intent(AddEditDreamActivity.this, SelectDreamActivity.class);
startActivityForResult(intent, SELECTED_DREAM);
break;
case R.id.saveDreamButton:
boolean hasError = false;
...
if (!hasError) {
// check if exit dream about id
try {
myDreamList = myDreamDao.queryForEq(MyDream.Columns.MY_DREAM_ID, dreamId);
} catch (SQLException e) {
e.printStackTrace();
}
chcek if dream exist
if (myDreamList != null && !myDreamList.isEmpty()) {
// update dream
UpdateBuilder<MyDream, ?> updateMyDream = myDreamDao.updateBuilder();
// condition update dream about dream id
try {
updateMyDream.where().eq(MyDream.Columns.MY_DREAM_ID, dreamId);
} catch (SQLException e) {
e.printStackTrace();
}
// update column title dream
try {
updateMyDream.updateColumnValue(MyDream.Columns.TITLE_DREAM, dreamTitle);
} catch (SQLException e) {
e.printStackTrace();
}
// update dream description
try {
updateMyDream.updateColumnValue(MyDream.Columns.DESCRIPTION, dreamDescription);
} catch (SQLException e) {
e.printStackTrace();
}
// update dream symbol
try {
updateMyDream.updateColumnValue(MyDream.Columns.SYMBOL_DREAM, selectSymbolDream);
} catch (SQLException e) {
e.printStackTrace();
}
try {
updateMyDream.update();
} catch (SQLException e) {
e.printStackTrace();
}
finish();
}
}
break;
}
}