public SpinnerCursorAdapter(Activity context, @Assisted CursorProvider cursorProvider, @Assisted String textColumn) {
// ...
}
public interface SpinnerCursorAdapterFactory {
public SpinnerCursorAdapter create(CursorProvider cursorProvider, String textColumn);
}
I inject this guy into my activity and then when I need a spinner its just
spinner.setAdapter(adapterFactory.create(new CursorProvider() {
Cursor get() {
return db.findAllColors();
}, DatabaseHelper.Columns.Color);
I have a lot of spinners and they are all actually dependent on each other so I built a custom adapter to handle all the query changes and cursor switches asynchronously.
Adam