Andriod Spinner not displaying list items.

Posted by user300339 on Stack Overflow See other posts from Stack Overflow or by user300339
Published on 2010-03-23T21:51:53Z Indexed on 2010/03/23 21:53 UTC
Read the original article Hit count: 302

Filed under:
|
|

I think I am going crazy right now. I am trying to create a spinner populated by a datatable but for some reason the dropdown list items text is not being displayed. I have looked all over and have seen other posts with people having this same problem. Can anyone help??

speciesList = (Spinner) findViewById(R.id.speciesList);
    spinnerCursor = nsfdb.fetchAllSpecies();
    startManagingCursor(spinnerCursor);
    //String []cArrayList = new String[]{"dog", "cat", "horse", "other"};
    String[] from = new String[]{"species"};

    int[] to = new int[]{R.id.text1};

    SimpleCursorAdapter locations = new SimpleCursorAdapter(this, R.layout.loc_row, spinnerCursor, from, to);

    locations.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    speciesList.setAdapter(locations);

The spinner gets created just fine and is populated with 4 items but whenever I click on the spinner I see 4 items with no text and just radiobuttons. If I select any of them I am getting the correct selected item value but there is just no data displayed.

© Stack Overflow or respective owner

Related posts about android-sdk

Related posts about java