Listview
에 목록을 표시하는 데 사용되는 ListAdapter
이 있습니다. 이제 선택한 항목을 삭제하기위한 긴 프레스 메뉴 조치가 추가되었습니다.Android ListAdapter가 업데이트되지 않습니다
public boolean onContextItemSelected(MenuItem item) {
AdapterView.AdapterContextMenuInfo menuInfo = (AdapterView.AdapterContextMenuInfo) item
.getMenuInfo();
final Long wordId = menuInfo.id;
// selected_row = menuInfo.position;
// To get the id of the clicked item in the list use menuInfo.id
switch (item.getItemId()) {
case CONTEXT_DELETE:
deleteRes(wordId); // delete function for the item
break;
default:
return super.onContextItemSelected(item);
}
//((BaseAdapter) favAdapter).notifyDataSetChanged();
return true;
}
삭제 후 목록이 업데이트되어 삭제 된 항목이있는 이전 목록을 표시합니다. notifyDataSetChanged()
을 사용해 보았지만 작동하지 않습니다. 문제의 해결 방법은 무엇입니까?
'deleteRes (wordId);'를 통해 기본 데이터를 삭제 했습니까? – xandy
데이터가 올바르게 삭제되고 있습니다 ... 다른 섹션으로 이동하면 .... 해당 섹션으로 돌아가서 올바른 목록을 제공하고 있습니다. –
어쩌면 어댑터와 같은 코드를 게시하여 문제가 무엇인지 알 수 있습니다. – xandy