본문 바로가기
IT/Android

Kotlin] notifyDataSetChanged() 안될때

by 깻잎쌈 2021. 3. 8.
반응형

 

 

notifyDataSetChange not working from custom adapter

When I repopulate my ListView, I call a specific method from my Adapter. Problem: When I call updateReceiptsList from my Adapter, the data is refreshed, but my ListView doesn't reflect the change...

stackoverflow.com

 

아래와 같이 했더니 잘된다.. 

fun updateReceiptsList(newlist: ArrayList<ListViewItem>) {
        listViewItemList.clear()
        listViewItemList.addAll(newlist)
        this.notifyDataSetChanged()

    }

 

 listviewAdapter.updateReceiptsList(list)

 

반응형

댓글