Skip to content
Advertisement

notifyDataSetChanged(); not refreshing ListView?

I’m working on a notes app and I’m running into trouble deleting notes: after the note is deleted, it still shows in the listview.

I’m trying to use notifyDataSetChanged(), but it doesn’t seem to be working for me.

MainActivity:

JavaScript

Advertisement

Answer

You are setting adapter with a list:

JavaScript

na.notifyDataSetChanged(); will only work if your notes list is changed.

And I don’t see that you remove/add/modify on notes list. If you are deleting item from list you need to remove it from notes list, too:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement