MultiSelectSpinner
MultiSelectSpinner copied to clipboard
update text value when using setSelection
when we use the control and we check for example 2 checkbox. the following value is written : text1, text2
is it possible to show that value when we call a MultiSelectSpinner when calling setSelection ?
regards
Same here restrictionCategory.setSelection(selectedCategories); marks items as checked, but the spinner doesnt show the selected items texts
You can rebuild the adapter at the end of the setSelection methods in order to achieve that:
_proxyAdapter.clear();
_proxyAdapter.add(buildSelectedItemString());
@psohm @RonEskinder
public void refreshSpinner(){
_proxyAdapter.clear();
_proxyAdapter.add(buildSelectedItemString());
}
String[] strings = { "Red", "Blue", "Green" };
MultiSelectSpinner mySpin = (MultiSelectSpinner)findViewById(R.id.spinner_options);
mySpin.setItems(strings);
mySpin.setSelection(new int[] {1,2});
mySpin.refreshSpinner();