[android-developers] Re: AdapterView.OnItemSelectedListener.onItemSelected called with out of date position argument!

2011-03-02 Thread Thierry Legras
Okay, as I could not find a way to fix that smoothly, I just used a flag ignoreNextOnItemSelected like described hereafter. Seems to me a dirty hack :( // called from another activity context updateSpinnerSelection(int newposition) { mPosition = newposition; // store it

Re: [android-developers] Re: AdapterView.OnItemSelectedListener.onItemSelected called with out of date position argument!

2011-03-02 Thread Kostya Vasilyev
Thierry, I think you are seeing interaction between the activity's onRestoreInstanceState and your setSelection. Should be pretty easy to check by overriding onRestoreInstanceState in ActivityA and/or the spinner and logging them - as well as your code that calls setSelection. Then you can

Re: [android-developers] Re: AdapterView.OnItemSelectedListener.onItemSelected called with out of date position argument!

2011-03-02 Thread Thierry Legras
Hi Kostya, Thanks to try to help to sort this out. unfortunatly I don't think this is the cause in this case: Activity A is a TabActivity that embeds activity B being in tab 2. Indeed when I select tab 1 from activity B using setCurrentTabByTag , *Activity A is already in running state* (I

Re: [android-developers] Re: AdapterView.OnItemSelectedListener.onItemSelected called with out of date position argument!

2011-03-02 Thread Thierry Legras
(putting again CC to android as your answer seems quite usefull to android community!) Wow, thanks Kostya, I am impressed by this so detailed answer :). Answers inline. 2011/3/2 Kostya Vasilyev kmans...@gmail.com Yes, if the activity isn't getting recreated, there won't be

Re: [android-developers] Re: AdapterView.OnItemSelectedListener.onItemSelected called with out of date position argument!

2011-03-02 Thread Kostya Vasilyev
02.03.2011 16:23, Thierry Legras пишет: (putting again CC to android as your answer seems quite usefull to android community!) Thank you. I meant to reply to the list, but Thunderbird sometimes has other ideas :) And good luck to you with resolving the issue. Wow, thanks Kostya, I am