开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜