如何在Android中使用列表适配器显示矩阵光标?

时间:2010-12-25 17:38:27

标签: sql android matrix cursor listadapter

我正在尝试向光标添加行(使用矩阵光标完成),然后将光标传递给列表适配器(资源适配器)。列表适配器只接受游标。如何向列表适配器添加行?

1 个答案:

答案 0 :(得分:1)

您不向列表适配器添加行。您只需向矩阵光标添加一行,如下所示:

mx.newRow().add(0).add("value of second column").add("value of third column");
mx.newRow().add(1).add("value of second column").add("value of third column");

... 等等 然后使用SimpleCursorAdapter将MatrixCursor“连接”到ListAdapter