Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bind table entries into Spinner in SQLite Database

I have created a table named Blood Group into my SQLiteDatabase. I have retrieved all data from table into logcat But I am not able to bind the data into the Spinner.

ArrayAdapter spinnerAdapter = new ArrayAdapter(this,
            android.R.layout.simple_spinner_item, yourListFromDB);
    spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    yourSpinner.setAdapter(spinnerAdapter);
like image 340
Rushabh Avatar asked Sep 03 '26 00:09

Rushabh


1 Answers

Finally I found the alternative answer:

 ArrayAdapter spinnerAdapter = new ArrayAdapter(this,android.R.layout.simple_spinner_item, yourListFromDB);
    String bloodgroups[]={ "O +ve", "A+ve","B+ve","AB+ve"};
          spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item,bloodgroups);
            yourSpinner.setAdapter(spinnerAdapter);
like image 197
Rushabh Avatar answered Sep 04 '26 16:09

Rushabh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!