Hyperjetta
Lurker
Im trying to fill a spinner with data from a table. That part works
fine. What i cant figure out is how to use the selection made
through the spinner.
if i use :
String someString = (String) classSpin.getSelectedItem().toString();
whats returned is an object of some sort. Am i missing a step? Im new to
both java and android so i hope this is something very obvious im
missing.
heres some of my code for the spinner:
Cursor classCur = db.getClasses();
startManagingCursor(classCur);
from = new String[]{DBAdapterStats2.KEY_CLASS};
to = new int[]{android.R.id.text1};
SimpleCursorAdapter classAdapter = new SimpleCursorAdapter(this,
android.R.layout.simple_spinner_item, classCur, from, to);
classAdapter.setDropDownViewResource
(android.R.layout.simple_spinner_dropdown_item);
classSpin.setAdapter(classAdapter);
basically, i just want to have whats displayed in the spinner returned as a string so that i can use it elsewhere in my database. any ideas on where ive gone wrong?
fine. What i cant figure out is how to use the selection made
through the spinner.
if i use :
String someString = (String) classSpin.getSelectedItem().toString();
whats returned is an object of some sort. Am i missing a step? Im new to
both java and android so i hope this is something very obvious im
missing.
heres some of my code for the spinner:
Cursor classCur = db.getClasses();
startManagingCursor(classCur);
from = new String[]{DBAdapterStats2.KEY_CLASS};
to = new int[]{android.R.id.text1};
SimpleCursorAdapter classAdapter = new SimpleCursorAdapter(this,
android.R.layout.simple_spinner_item, classCur, from, to);
classAdapter.setDropDownViewResource
(android.R.layout.simple_spinner_dropdown_item);
classSpin.setAdapter(classAdapter);
basically, i just want to have whats displayed in the spinner returned as a string so that i can use it elsewhere in my database. any ideas on where ive gone wrong?