Reputation: 79
I have a listView with checkbox which populate from sqlite table. I need to have another column in listView that shows another sqlite table column.
I'd like to show 3 columns:
ProductName CheckBox ProductPrice.
Any suggestions?
Upvotes: 0
Views: 2526
Reputation: 29199
you can use custom list adapter for the purpose.
http://blog.cluepusher.dk/2009/11/16/creating-a-custom-cursoradapter-for-android/
use SimpleCursorAdapter to bind data with Cursor columns:
Lets Assume you have a row layout defined into row_layout.xml, having three textviews textview1, textview2, textview3, which needed to be binded with COLUMN_NAME1, COLUMN_NAME2, COLUMN_NAME3,
S
impleCursorAdapter adapter2 = new SimpleCursorAdapter(this,
android.R.layout.simple_spinner_item, // Use a template
// that displays a
// text view
cur, // Give the cursor to the list adapter
new String[] {COLUMN.NAME1, COLUMN.NAME2. COLUMN.NAME3}, // Map the NAME column in the
// people database to...
new int[] {R.id.text1, R.id.text2, R.id.text3});
Upvotes: 1
Reputation: 1980
You can get information about listview from http://www.vogella.de/articles/AndroidListView/article.html#listadvanced_interactive
Upvotes: 1