Mark thanks for the reply,
To be more specific, here is a snippet from my spinner code:
String[] array = {"Select", "Building", "Here"};
Spinner s2 = (Spinner) findViewById(R.id.spinner2);
ArrayAdapter<String> cadapter = new ArrayAdapter(this,
android.R.layout.simple_spinner_item, array);
cadapter.setDropDownViewResource
(android.R.layout.simple_spinner_dropdown_item);
s2.setAdapter(cadapter);
my problem is replace array (to make it dynamic) with my 'title'
column from my 'chart' table in my 'dbm' database. I know it's a
simple line, but I can't seem to get it.
On Jun 18, 3:30 pm, "Mark Murphy" <[email protected]> wrote:
> > I created a database with records in it and everything. I am trying to
> > use its fields and put it in a spinner. The database contains
> > university names. I created a spinner with:
>
> > final Spinner s = (Spinner) findViewById(R.id.spinner);
> > ArrayAdapter adapter = ArrayAdapter.createFromResource(
> > this, R.array.universities,
> > android.R.layout.simple_spinner_item);
> > adapter.setDropDownViewResource
> > (android.R.layout.simple_spinner_dropdown_item);
> > s.setAdapter(adapter);
>
> > where I am feeding the spinner the records from an array. I want to do
> > it from the database that I created. I read thru the classes and there
> > are 2 ways but I can't find a proper code to use any of them. I just
> > want to insert the code to get records from the database. It shouldn't
> > be complicated is it?
>
> Use a CursorAdapter (or SimpleCursorAdapter) to wrap the Cursor you get
> back from a database query().
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> _The Busy Coder's Guide to Android Development_ Version 2.0 Available!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---