How to display matrix cursor using list adapter in Android?

风流意气都作罢 提交于 2019-12-11 10:40:05

问题


I am trying to add row to the cursor (which is done with matrix cursor), then pass the cursor to the list adapter (resource adapter). The list adapter takes only a cursor. How do I add a row to the list adapter?


回答1:


You don't add a row to the list adapter. You just add a row to the matrix cursor like this:

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");

... etc. Then with a SimpleCursorAdapter you "connect" the MatrixCursor to the ListAdapter



来源:https://stackoverflow.com/questions/4531031/how-to-display-matrix-cursor-using-list-adapter-in-android

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