I've been banging my head on this problem for a few hours, and I think it's time that I ask for help. This is my first serious attempt at making an app, and I've got a situation where I want to pull a list of strings from a database to present in a Spinner. During my earlier stages of development, I had a fixed list in the strings.xml file, but I realized that I may want to modify the list via the web at a later time, so I moved to a database solution for it. I've got the database side of things squared away, and I've been working on a content provider since last night.

At this point, I know the content provider is successfully querying data from the target table and returning it to the Spinner, but all I get are blank lines in the Spinner instead of the strings. See http://www.badlucksoft.com/blank_spinner.png .

Here's the code that I currently have linking the content provider to the spinner:

        Spinner spinner = (Spinner) findViewById(R.id.myspinner);
        String []projection = new String [] {
                "_id","label_strings"
        };
        String [] c = new String[] {"label_strings"};
        int [] i = {R.id.myspinner};
        Uri uri = "my.content.provider.uri";
        Cursor managedCursor = managedQuery(uri,projection,null,null,null);
SimpleCursorAdapter sca = new SimpleCursorAdapter(this,android.R.layout.simple_spinner_item,managedCursor,projection,i);
        spinner.setAdapter(sca);

I've been changing around the parameters for instantiating SimpleCursorAdapter trying to get this working, including setting the "from" and "to" parameters to null and other values. Those experiments always resulted in either an exception or even less than what I'm getting now (as in an empty spinner).

Can anyone deduce what I'm doing wrong based on this information, and if not, what else do you need me to provide?

Thank you,
Raymond

--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to