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();
startManagingCursor(c);
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
        R.layout.list_item,
        c,
        new String[]{MyDBHelper.KEY_NAME},
        new int[]{R.id.field_name});
setListAdapter(adapter);

My problem is, I don't know how i can modify simply this code in order
to get the "MyDBHelper.KEY_ID" value when I click an item on the
listView.

I suppose it should be something like this :

Cursor c = data_db.getAll();
startManagingCursor(c);
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
        R.layout.list_item,
        c,
        new String[]{MyDBHelper.KEY_ID, MyDBHelper.KEY_NAME},
        new int[]{R.id.field_id, R.id.field_name}); // How to hide the KEY_ID
value ?
setListAdapter(adapter);

Thanks for your help.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to