更新列表视图动态与适配器适配器、视图、动态、列表

2023-09-12 21:39:20 作者:15.我碍你°

本教程使用一个SimpleAdapter工作正常,但我需要更新在适配器阵列时新的数据被输入。

This tutorial uses a SimpleAdapter which works fine, but I need to update the arrays in the adapter when new data is entered.

能否请你指导我如何使用别的东西比SimpleAdapter更新的ListView?

Could you please guide me on how to update a ListView using something else than a SimpleAdapter?

推荐答案

使用 ArrayAdapter 通过一个ArrayList支持。改变数据,只需更新列表中的数据,并调用adapter.notifyDataSetChanged().

Use a ArrayAdapter backed by an ArrayList. To change the data, just update the data in the list and call adapter.notifyDataSetChanged().