How to update an item from ArrayList on ArrayAdapter in Android

大兔子大兔子 提交于 2019-12-22 17:22:21

问题


I am new at developing Android.I have a ListView and custom ArrayAdapter which holds an arraylist.I want to update arraylist specific item by position.How can I handle please help me thanks in advance.


回答1:


Assuming your adapter is storing a List of Foo objects.

Foo item = mAdapter.getItem(position);
item.setValue("blah");  //Or whatever you need to update
mAdapter.notifyDataSetChanged();


来源:https://stackoverflow.com/questions/27344840/how-to-update-an-item-from-arraylist-on-arrayadapter-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!