If the spinner uses a selected text formatter with a type, calling setSelectedIndex crashes:
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Locale
...
at org.angmarch.views.NiceSpinner.setTextInternal(NiceSpinner.java:307)
at org.angmarch.views.NiceSpinner.setSelectedIndex(NiceSpinner.java:323)
The problem is setSelectedIndex calls setTextInternal(selectedTextFormatter.format(adapter.getItemInDataset(position)).toString()); which then calls setText(selectedTextFormatter.format(item)); but item is already a string and not the expected type.
If the spinner uses a selected text formatter with a type, calling
setSelectedIndex
crashes:Example:
The problem is
setSelectedIndex
callssetTextInternal(selectedTextFormatter.format(adapter.getItemInDataset(position)).toString());
which then callssetText(selectedTextFormatter.format(item));
but item is already a string and not the expected type.