Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a spinner, in which I need to populate the spinner data from sqlite database. I am facing a problem in getting the selected value and text of the item that is selected in the spinner.vHow is this possible ? Also, how to populate data to spinner ?
Posted

1 solution

Get values from the database and store it in an array and populate in spinner.
String[] array;  //Use must initialize

Spinner spinner = (Spinner) findViewById(R.id.spinner1);

ArrayAdapter arrayAdapter =  new ArrayAdapter(this,android.R.layout.simple_spinner_item, array);

spinner.setAdapter(arrayAdapter);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900