Reputation: 41
I have used ListView
added and delete option but when i clicked delete button database value is deleted but ListView
is not refreshed. I have put
adapter.notifyDataSetChanged();
but the list doesn't refresh.
Upvotes: 0
Views: 168
Reputation: 3261
Try this, call adapter.notifyDataSetChanged()
inside runOnUiThread
.
YourActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
adapter.notifyDataSetChanged();
}
});
Upvotes: 1
Reputation: 796
You have to call .invalidate();
on the ListView to tell the framework the the view is outdated and should be redrawen!
Upvotes: 0
Reputation: 6711
UI is update outside the main thread. Put all the logic inside an asynctask
and in postexecute, call the adapter.notifyDataSetChanged();
Upvotes: 0