I'm attempting to make a dynamic drop down that will be filled by a SQLite table. I have a Cursor object which I can pull the data I need from. I've been able to accomplish loading the values into the drop down with the code below:
Spinner s = (Spinner) findViewById(R.id.spinner);
ArrayAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
s.setAdapter(adapter);
try{
Cursor cursor = getAccounts();
int accountnameIndex = cursor.getColumnIndexOrThrow(ACCOUNT_NAME);
if(cursor.moveToFirst()){
do{
adapter.add(cursor.getString(accountnameIndex));
} while(cursor.moveToNext());
}
} finally {
MintLink.close();
}
My problem is that I need the a selection from the drop down to also contain the RowID of the item selected. I need to be able to select one item and have access to the value of that item in the back end. For example, think of a drop down in HTML. Each drop down selection has it's own hidden value that is pulled. I need this value to be hidden for me to allow me to know which ID they choose.