XML array from SQLite database
I am using SQLite to store school classes. I want to fill in a Spinner with the classes that get stored in the database. How would I grab all the classes in the DB and load them into a s开发者_开发知识库pinner?
Step #1: Use query() or rawQuery() to get a Cursor with the results of a query on your database.
Step #2: Wrap the Cursor in a CursorAdapter, set to populate rows with your database results.
Step #3: Attach the CursorAdapter to the Spinner.
Here is a sample project showing using a CursorAdapter with a database query, but for a ListView. Here is a sample project showing using a CursorAdapter with a Spinner, but from a query against a content provider, not a database.
加载中,请稍侯......
精彩评论