0
我正在使用LazyList進行自定義ListView,並且在用戶更改後需要刷新列表,在這種情況下,將項目添加爲收藏夾。如何使用LazyAdapter更改後的列表
我試着使用:
list.invalidate();
((BaseAdapter) list.getAdapter()).notifyDataSetChanged();
和
list.notifyDataSetChanged();
,但它似乎並不在LazyList工作。
這是小部分從我的代碼:
ListView list;
LazyAdapter adapter;
//set the custom list adapter
adapter = new LazyAdapter(this, fileString, null, movieNameString,
mId, DataBaseSize,myScore,year4list,cast4list,favArray,bellArray);
list.setAdapter(adapter);
@Override
public boolean onContextItemSelected(MenuItem item) {
final AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
switch (item.getItemId()) {
case R.id.context_fav:
//here theres non- importent code that makes favorite
pops when user click on it
list.invalidate();
((BaseAdapter) list.getAdapter()).notifyDataSetChanged();
出於某種原因,沒有更新的列表;只有當我使用Intent並重新輸入活動時,列表纔會更新。有任何想法嗎?