• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps DataBase to Spinner

Arigead

Lurker
There are a few threads in this forum on the subject of spinners but very few answers to most of the questions. I've searched the Internet and followed the android tutorial in [1] which basically implements a spinner on an array defined in an xml resource file. That works grand.

The next step is to work on a database table to select a number of options and select one of those. If the Database table is empty then perhaps the logical option is to have an additional "Add Category". This step is proving very difficult. I found an example [2] but this code will no run in the emulator and it doesn't give me any specific error it just informs me that the application has terminated unexpectedly.

From commenting out parts the line that's causing the problem is when the spin adapter is created. I've looked at the documentation for the spinadapter but it hasn't helped at all.

This strikes me as a fairly common design pattern and I'm sure somebody must have crossed this bridge? Anybody please and thanks in advance.

[1] Hello, Spinner | Android Developers

[2] Manually adding items to a Spinner linked to a Cursor :: anddev.org - Android Development Community | Android Tutorials
 
Use logcat to find out what the error is. To view logcat in Eclipse, click the "Debug" button at the top right of the screen, then at the bottom, there will be a number of "window panes". One of those is "logcat". This will show you the error that is occuring.
 
Back
Top Bottom