How to refresh a ListActivity within a TabView?
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.notifyDataSetChang开发者_JAVA技巧ed();
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?
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.
You should use this on delete button click:
((EfficientAdapter)listview.getAdapter()).notifyDataSetChanged();
where EfficientAdapter is your Adapter class.
Hope this will work for you...:)
精彩评论