MaterialSpinner
MaterialSpinner copied to clipboard
How to reset the MaterialSpinner?
I have 4 spinners whose values depend on the selection of the others, when I select a value of the first spinner I update the value of the other spinner, I am working with the adapters to update the data and it does but visually the spinner does not reset to its value by default (with the hint). This is my code:
@Override
public void showDepartamentos(List<LocalidadTO> departamentos) {
adapterDepartamentos.clear();
adapterProvincias.clear();
adapterDistritos.clear();
adapterComplejos.clear();
this.departamentos = departamentos;
for (LocalidadTO l : departamentos) {
adapterDepartamentos.add(l.getNombre());
}
adapterDepartamentos.notifyDataSetChanged();
adapterProvincias.notifyDataSetChanged();
adapterDistritos.notifyDataSetChanged();
adapterComplejos.notifyDataSetChanged();
}
My data is shown in the spinner but I just want the spinner to be visually reset by default with the hint
I have the same problem, I also set a new adapter on the spinner and is not working.
The .setSelection(position); for the current adapter on the spinner doesn't reset the initial spinner position.
@pepitofriki I just found a solution, just set your selected position to 0 before clear the adapter.