display arrayof items from database(sqlserver) in spinner?

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

display arrayof items from database(sqlserver) in spinner?

Postby deepu » Mon Feb 01, 2010 6:29 am

How to display particular array of items from a database (SQLServer) in a Spinner of Android?
deepu
Freshman
Freshman
 
Posts: 6
Joined: Mon Feb 01, 2010 6:03 am
Location: hyd

Top

Postby jayaram » Mon Feb 01, 2010 12:22 pm

Hi Deepu,
This is Jayaram. For loading a spinner with values in DB, first bring them into an Array.
Then for an array of Strings, use the following code.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, array);        
  2.  
  3. spinner1.setAdapter(adapter);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4

That's it. BTW, sqlserver seems weird for Android.
jayaram
Junior Developer
Junior Developer
 
Posts: 16
Joined: Wed Jul 29, 2009 3:37 am
Location: India

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: Google [Bot], Google Feedfetcher and 4 guests