I have been developing Android application, and I have one question – ListView uses SimpleCursorAdapter (this cursor gets information from SQLite db), but if I edit my database then ListView will be empty. How can I fix it? I want that after editing ListView will refresh. I hope you can help me. Thank you.
Adapter:
SimpleCursorAdapter adapter=new SimpleCursorAdapter(this, android.R.layout.simple_list_item_2,
DictionaryDbWrapper.getInstance().getAllWords(), new String[]{DictionaryDbHelper.WORD, DictionaryDbHelper.CATEGORY},
new int[]{android.R.id.text1, android.R.id.text2});
mList.setAdapter(adapter);
Updating code:
mDb.update(DictionaryDbHelper.TABLE_NAME, word, DictionaryDbHelper._ID+"=?",
new String[]{String.valueOf(id)});
may be you need to assign Adapter to ListView after each refresh?