Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Created attachment 7152 [details]
The generated Java code that fails to compile
private class DurationAdapter : ArrayAdapter<int>
public DurationAdapter(Context context, int textViewResourceId, int objects) : base(context, textViewResourceId, objects)
Error 43 cannot find symbol
symbol : constructor ArrayAdapter(android.content.Context,int,int)
location: class android.widget.ArrayAdapter
super (p0, p1, p2);
...\SettingsActivity_DurationAdapter.java 66 3
The whole SettingsActivity_DurationAdapter.java is attached.
I have checked this issue and observed the same behavior mentioned in bug description. To reproduce this issue I have created a simple android application and implemented the code provided in bug description.
Screencast : http://www.screencast.com/t/UQW4GyWEkWO
Environment Info :
Xamarin.Android : 4.12.5 and 4.12.4
Can be worked around by replacing int with IList<int>.
So far it is due to Java Generics related limitation (last one at http://developer.xamarin.com/guides/android/advanced_topics/limitations/ )
Android.Widget.ArrayAdapter<T> is not really a true binding for android.widget.ArrayAdapter<T>. The true binding is Android.Widget.ArrayAdapter, and it basically maps T to Java.Lang.Object. ArrayAdapter<T> is just a workaround to bring some generic ease of use. By its nature, this T has to be either Java.Lang.Object (so that it can be mapped to java.lang.Object as ArrayAdapter's ACW [*1] is defined so) or some special things like collections. Primitive Java types cannot be directly converted to java.lang.Object, hence that Java compiler error is expected.)
Apart from using IList<int>, the more valid-looking way is to use Java.Lang.Integer instead of int.
We may visit this issue later on, but that could bring breaking API changes and we may need to wait for not near future versions.