When i open Activity for EditRecord i want to select spinner row for
adequate value in edited record
I find code like below, but its ok for few records in spinner, but when
spinner.cursor contains many records i think its not right idea.
Is any other method to select spinner row for known rowid ?
Spinner spinner = (Spinner) findViewById(R.id.spinner);
spinner.setAdapter(new SimpleCursorAdapter(...));
for (int i = 0; i < spinner.getCount(); i++) {
Cursor value = (Cursor) spinner.getItemAtPosition(i);
long id = value.getLong(value.getColumnIndex("_id");
if (id == rowid) {
spinner.setSelection(i);
}
}
--
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