[android-developers] ListView, SimpleCursorAdapter and Cursors

2010-06-10 Thread ColletJb
Hi, I have a very simple issue i actually can't fix :( I have a basic database with fields, let's say MyDBHelper.KEY_ID, MyDBHelper.KEY_NAME, MyDBHelper.KEY_DATA and a listview where i only display the MyDBHelper.KEY_NAME field. I used this sample of code : Cursor c = data_db.getAll();

Re: [android-developers] ListView, SimpleCursorAdapter and Cursors

2010-06-10 Thread Adrian Vintu
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.list_item, c, new String[]{MyDBHelper.KEY_NAME, MyDBHelper.KEY_ID}, new int[]{R.id.field_name}); i.e. leave the KEY_ID at the end of the String[] and do not link it to any View. Create the context