使用适配器动态更新列表视图 [英] update listview dynamically with adapter

查看:32
本文介绍了使用适配器动态更新列表视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

教程使用了一个运行良好的 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 other 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().

这篇关于使用适配器动态更新列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆