刷新删除操作后,从一个ArrayList创建列表视图 [英] refresh listview created from an arraylist after delete operation
问题描述
我看到有关refreshin一个ListView太多的问题,我已经试过的议题每一个解决方案,但没有为我工作。
I have seen too many questions about refreshin a listview and I have tried every solution on the topics but none worked for me.
曾尝试 notifysetdatachange()
, invalidateviews
, refreshdrawablestate()
,但没有奏效。
have tried notifysetdatachange()
, invalidateviews
, refreshdrawablestate()
but none worked.
我有一个的ArrayList
,我从arraylist.and我希望它删除一个项目 longclick
术后从listview.but它不会消失。
I have an arraylist
and after an longclick
operation I am deleting an item from arraylist.and I want it to disappear from listview.but it does not.
但删除后,如果我打开另一个活动,回头到包含我的列表视图活动
消失。
but after deletion if I open another activity and turn back to the activity which contains my listview
it disappears.
所以我删除操作是成功的,我只是想知道如何刷新列表视图。
so my deletion operation is successful, I just want to know how to refresh listview.,
我没有张贴code,因为没有什么,我只是用独特的
I did not post a code because there is nothing unique I am just using
我有一个的ArrayList
名为 al_6
。我正与物体填充它。
I have an arraylist
named al_6
.I am filling it with objects.
然后我将它们发送到我的适配器
像
then I send them to the my adapter
like
adapter = new ContentSearchListAdapter(getActivity(), channels2,
options);
listview.setAdapter(adapter);
而当我想从我的ArrayList中删除对象。
and when I want to delete an object from my arraylist.
al_6.remove(position)
和前面说过的删除操作成功
and as I said before the deletion operation is successful
推荐答案
您应该使用这些语法实现它
Your should use these syntax for achieving it
((YourAdaptor)Listview.getAdaptor()).notifyDataSetChange();
我还希望对您有所帮助...:)
I hope its helpful to you...:)
这篇关于刷新删除操作后,从一个ArrayList创建列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!