I'm in a trouble managing a spinner, so may I ask for your help ?
I have a spinner with its adapter. I initialize the spinner with a list of values when starting my activity. Then I force the selected value to be the one used in the object that I manage.
Once the screen is initialized : When the user selects a value in the spinner, according to the selected value, I may continue (or not) to another activity for let the user choose a complementary and necessary value. If the user "cancels" this second activity, I want to rollback the spinner to its previous selected value, and cancel some actions made in the meantime. If the user goes to the end of the second activity, everything is fine and I want juste to refresh the spinner display with the datas selected in the second activity (I overload the getView method in the adapter to do this).
Overall, I can easily do all of this, however, when I force the selected value in the spinner at the begining of my activity, or whene returning back from the second activity by "Cancel", the change value event is catched and the second activity is triggered (the user did not click anything at all).
How would you allow the second activity to be lauched only if the change of the selected value in the spinner is due to a manual action from the user, and prevent that same second activity to be launched when the value of spinner is changed "in the code "?
I tried many solutions, as setting a boolean into the adapter that tells if the next event will be raised because of an "in the code" action. Or also putting a boolean in the adapter that tells if the adapter has initialised itself, and I force that boolean to true on the forst change catched event. But nothing that really works fine.
Thank you for your help.
Oliver