I have been going through the threads regarding the spinners and when the onItemSelected is triggered. I concluded that it is triggered whether you manually select a spinner item or your programmatically select an item through the spinner.setSelection(position) method.
My problem is that OnItemSelected callback method is called first within my code, but it is executed after several other methods finish executing. This is an undesired behavior because my code logic depends on certain steps being executed in sequence.
if(conition is true)
fillSpecialtySpinner();
if(another condition is true)
fillSubSpecialtySpinner();
The fillSpecialtySpinner() method contains the spinner.setSelection(position) line of code. But somehow it is executed after the second if is checked and the fillSubSpecialtySpinner finishes executing.
Any help would be appreciated. Thank you in advance!