I'm going to assume that you are creating a Spinner adapter based on List<CharSequence>
or something similar. You can use this to search for a selection, for example:
String name = model.getName(); int index = list.indexOf(name); if (index != -1) spinner.setSelection(index);
Obviously, if your model does not contain any "named" data, then there is nothing that could be selected in Spinner, so you may need to add some logic to process it. If the model has a "name", then find its index in the source list, which was used as the data source for the adapter. Only if the event found has been set, set the selector to the same index.
source share