我必须的simpleCursorAdapter设置成一个ListView。

如何实现?

感谢。

有帮助吗?

解决方案

这问题有点模糊,所以我很想简单地回答:

my_list_view.setAdapter(my_cursor_adapter);

但也有在文档中更好的解释和例子。这里是一个:

HTTP:/ /developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List2.html

其他提示

<强>的ListView 具有方法declard为:

public void setAdapter (ListAdapter adapter)

和用于文档的 ListAdapter 列表的 SimpleCursorAdapter 作为它自己的间接子类中的一个。因此,要设置您的 SimpleCurseAdapter 的ListView ,你只需要调用 setAdapter 与你的适配器的视图。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top