Question

The tab activity queries the database and binds the result to the list view.

The problems is when i clicked on the delete button, it works but the list view did not refresh.

the things i've tried:

adapter.notifyDataSetChanged();
adapter.notifyDataSetInvalidated();
listview.invalidateViews();
listview.setAdapter(adapter);

so far none is working, i have to click another tab (tab1) then click back (tab2) to refresh it.

Any ideas?

Was it helpful?

Solution

Note sure about the way you are using to delete. I think you are manipulating ListView directly. You have to use remove() method of adapter. In fact you have to manipulate the contents of the list through the adapter.

OTHER TIPS

You should use this on delete button click:

((EfficientAdapter)listview.getAdapter()).notifyDataSetChanged();

where EfficientAdapter is your Adapter class.

Hope this will work for you...:)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top