I am querying the database and adding the results to a list.
everything works fine until i set the adapter (setAdapter) on my
spinner control. I get the error "the application has stopped
unexpectadely". can anyone tell me what Im doing wrong?
List<String> results = new ArrayList<String>();
Cursor c = myDB.rawQuery("SELECT PKDrawingID, drawingName FROM
" +
MY_DATABASE_TABLE,null);
/* Get the column index */
int MyNameColumn = c.getColumnIndexOrThrow("drawingName");
c.moveToFirst();
if (c != null) {
/* See if we got any results */
if (c.isFirst()) {
int i = 0;
do {
i++;
String drawingName =
c.getString(MyNameColumn);
results.add(drawingName);
} while(c.moveToNext());
}
}
Spinner spinner_drawings = (Spinner) findViewById
(com.test.test3.R.id.spinner_drawings);
ArrayAdapter<CharSequence> adapter = new ArrayAdapter(this,
android.R.layout.simple_spinner_item, results);
adapter.setDropDownViewResource
(android.R.layout.simple_spinner_dropdown_item);
spinner_drawings.setAdapter(adapter);//this is where it
bombs out and i have to close the application
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---