- I have an xml layout file which contains a few widgets including a Spinner
- I want to display a list of strings in the spinner, the list is generated at runtime as a result of a function so it can not be in arrays.xml.
I tried doing:
String[] SpinnerItems = GetMyCustomItems();
((Spinner)findViewById(R.id.MySpinner)).setAdapter(new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_list_item_1,SpinnerItems));
But this crashes my application.
What would be the correct way to accomplish this?