I need to store the value selected from the spinner into my already existing table in sqlite database.I cannot get a clear idea from the internet because it only shows how to enter the spinner values in db and not the selected value.This is the code for implementing spinner(static)
Spinner staticSpinner = (Spinner) findViewById(R.id.static_spinner);
// Create an ArrayAdapter using the string array and a default spinner
ArrayAdapter<CharSequence> staticAdapter = ArrayAdapter
.createFromResource(this, R.array.man_array,
android.R.layout.simple_spinner_item);
// Specify the layout to use when the list of choices appears
staticAdapter
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// Apply the adapter to the spinner
staticSpinner.setAdapter(staticAdapter);
Spinner dynamicSpinner = (Spinner) findViewById(R.id.dynamic_spinner);
String[] items = new String[] {"rate_of_flow", "30", "40", "50" };
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, items);
My application can use both dynamic and static spinner.I don't have any preference.Can you help me?
Aucun commentaire:
Enregistrer un commentaire