3

I am new to android. I have made Microsoft's SQL 2014 server connection with JTDS.jar. I want to create a drop down option menu in my android app that gets the entry from database.

Although, I can fetch the result from database using ResultSet and ResultSetMetaData but I am not sure, How would I show those results onto the dropdown. Also, how would make sure which option in drop down is selected.

As this answer shows how to create a drop down and show to populate the drop down list. What I need to ask is, do I need to store the database results into an array and then feed them to drop down or there is some other way around?

Community
  • 1
  • 1
abhimanyuaryan
  • 3,882
  • 5
  • 41
  • 83
  • 1
    The dropdown (aka `Spinner`) is nothing but a view. What matters is the `Adapter` you will use. For instance, if you create an Adapter that extends `ArrayAdapter`, you will need to provide a `List` of objects as the adapter parameter. Anyway, for starters you shouldn't be connecting to the database directly from your app, try creating a web service to do that (Sinatra and Node.js are good ways to start). If you use the web service, its output can be the array of objects you need. – Paulo Avelar Sep 02 '15 at 17:15

0 Answers0