i have a personaliced spinner (that uses a adapter that uses a personalized xml layout file)
i want to pass him a array of strings, programatically created, instead of passing the tipical hard coded string array of strings.xml... but i can't!! if i try to pass a array of strings, eclipse tell me that he needs a reference of a item from resources (a hard coded string array from strings.xml)
also i tryed to use the answer of this another way: Android: Create spinner programmatically from array
but that way didn't work's for me, because that way must use the default layout android.R.layout.simple_spinner_item
and i won't work with that layout, i need to use my personalized layout (R.layout.spinner_layout
), and that method didn't let me to use personalized layouts for the spinner
this is my code:
String[] teams=(String[])Primera.getTeams().toArray();
ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.teams_array, R.layout.spinner_layout);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
TeamsSpinner.setAdapter(adapter);
TeamsSpinner.setOnItemSelectedListener(new MyOnItemSelectedListener());
i need to changue R.array.teams_array
, to teams
, but i can't because the reason i told some lines up
can anyone help me ?
thanks