Bug 13725 - Calling the SetSelection(0,true) does not fire the ItemSelected event handler
Summary: Calling the SetSelection(0,true) does not fire the ItemSelected event handler
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.8.x
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2013-08-02 16:56 UTC by Tracy
Modified: 2017-07-05 20:55 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Tracy 2013-08-02 16:56:28 UTC
In an app I have a set of spinners.
In the OnCreate I have the following event handler.

lstClasses.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs>(lstClasses_ItemSelected);  

Later On I have code that fills in the spinner with a SimpleCursorAdapter

I then have a loop that will find the correct item in the spinner and select it.

ICursor reader = (ICursor)lstClasses.GetItemAtPosition(0);

for (int i = 0; i < reader.Count; i++)
   if (reader.GetString(0) == sLastClass)

When the lstClasses.SetSelection(I,true) is hit it calls the event handler and does its thing.
This has been working with no problems for over a year now with our Galaxy Player 5's (android 2.3.6).
We have just now introduced other Android devices into the mix and they are running Andoid 4.1 or above (Galxay tab 3, GS3, GS4)
When I run the code on these devices it does not fire off the event.
As far as I can tell from the Android docs, this should still fire the event, regardless of the android version.
I only have the single Gingerbread device, but have tried this on ICS and Jelly bean with no luck.

I am hoping that this is a bug, and not a breaking change in android versions.
Please help, I do not want to keep two different code bases.

Comment 1 Cody Beyer (MSFT) 2017-07-05 20:55:07 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Android. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.