Reputation: 2202
I have this problem. I read with BufferedReader text from one system file, this text contains for example 5 WORDS, but in another case it can contain less or more words, then I put this text (these words) to ONE string and save that string to shared preferences.
And my question is that how can I make a spinner from this string?
I have seen it's possible.
Upvotes: 0
Views: 252
Reputation: 7585
I'm not really sure what your preferences string looks like, but assuming that the words are separated with a ",".
Spinner spinner = new Spinner(this);
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, yourString.split(","));
spinner.setAdapter(spinnerArrayAdapter);
Upvotes: 2