You dont need shared preference to load values in spinner. You just need to declare array in string.xml file and load that.I am giving you my code.Just use it.:-
- Greece
- United Kingdom
- Italy
- France
- Germany
- Turkey
- Poland
- India
Spinner spinCountry;
spinCountry= (Spinner) findViewById(R.id.spinCountry);//fetch the spinner from layout file
ArrayAdapter adapter = new ArrayAdapter(this,
android.R.layout.simple_spinner_item, getResources()
.getStringArray(R.array.country_array));//setting the country_array to spinner
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinCountry.setAdapter(adapter);
//if you want to set any action you can do in this listener
spinCountry.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView> arg0, View arg1,
int position, long id) {
}
@Override
public void onNothingSelected(AdapterView> arg0) {
}
});