Android List view refresh

前端 未结 5 592
闹比i
闹比i 2020-11-27 19:02

I have one ListView which is showing me some data through an array (which is in another class and I\'m accessing it through it\'s object).

Whenever I delete an elem

5条回答
  •  粉色の甜心
    2020-11-27 19:49

    You have to notify your ListView adapter that the data has changed.

    listViewAdapater.notifyDataSetChanged();
    

    If that for some reason doesn't work and there are some wierd situations where it seems like it wasn't notifying, you can just reassign your adapter via the constructor with the updated array.

提交回复
热议问题