I have seen too many questions about refreshin a listview and I have tried every solution on the topics but none worked for me.
have tried notifysetdatachange()
, invalidateviews
, refreshdrawablestate()
but none worked.
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.,
I did not post a code because there is nothing unique I am just using
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);
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();