Assigning SQL result to a Listview
I am trying to build a listview which wil开发者_运维百科l have the format of
{PlayerAname} vs {PlayerBname}
{PlayerAScore} - {PlayerBScore}
So this is a more complex (atleast to me) listview as it will have 4 properties I would need to set in it...
I've looked for some tutorials or examples but haven't found what I was looking for. I need to know how to set the properties and how to build the layout of a single listview item
thanks in advance.
You want to use a SimpleCursorAdapter. The docs for ListActivity show how to bind an SQLite result set to a list view using a SimpleCursorAdapter, including how to direct each column into a particular field of the row. The example uses the stock android.R.layout.two_line_list_item
row layout, but you can use your own to lay out the data in a row as you see fit.
精彩评论