我添加,删除和更新数据但是在我添加1项后删除或更新然后我重新加载应用数据不会改变
public void deletePrefix(Prefix prefix) {
Log.i(TAG, "MyDatabaseHelper.delete ... " + prefix.getOldPRe());
SQLiteDatabase db = this.getWritableDatabase();
db.delete(TABLE_PREFIX, COLUMN_PREFIX_ID + " = ?",
new String[]{String.valueOf(prefix.getId())});
db.close();
}
public void updatePrefix(Prefix prefix) {
Log.i(TAG, "MyDatabaseHelper.updatePrefix ... " + prefix.getOldPRe());
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(COLUMN_PREFIX_ID,prefix.getId());
values.put(COLUMN_PREFIX_OLD, prefix.getOldPRe());
values.put(COLUMN_PREFIX_NEW, prefix.getNewPre());
db.update(TABLE_PREFIX, values, COLUMN_PREFIX_ID + " = ?",
new String[]{String.valueOf(prefix.getId())});
db.close();
}
db.addPrefix(prefix);
prefixList.add(prefix);
initializeRCV();
db.updatePrefix(prefix);
prefixList.remove(pos);
prefixList.add(pos, prefix);
initializeRCV();
db.deletePrefix(prefixList.get(position));
prefixList.remove(position);
initializeRCV();
somtime重新加载应用数据有所改变,但有时它不活跃