Wednesday, 7 August 2013

How to get _ID with SimpleCursorAdapter

How to get _ID with SimpleCursorAdapter

So far I got this
db = new MYDBHelper(this);
constantsCursor = db.getReadableDatabase().rawQuery(
"SELECT _ID, title, value " + "FROM constants ORDER BY title",
null);
ListAdapter adapter = new SimpleCursorAdapter(this, R.layout.item,
constantsCursor, new String[] { DBHelperMen2.TITLE, DBHelperMen2.VALUE },
new int[] {R.id.item_name, R.id.item_points });
listata = (ListView) findViewById(R.id.listView1);
listata.setAdapter(adapter);
BU I have one more field named item_number. I this field I want to write
the _ID number
How can I do this ?
new SimpleCursorAdapter(this, R.layout.item, constantsCursor, new String[]
{ **???** ,DBHelperMen2.TITLE, DBHelperMen2.VALUE }, new int[]
{**R.id.item_number** , R.id.item_name, R.id.item_points });

No comments:

Post a Comment