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 1874 [details]
Mono for Android repro app
Unless I'm overlooking something, the OnChildClick method in ExpandableListActivity does not get called when you click on a child item in the list. Attached is a sample application demonstrating the problem. I've also attached an equivalent app in Java, where onChildClick does correctly get called when an item is clicked. I'm currently running Mono for Android 4.0.6.
Created attachment 1875 [details]
Equivalent app in Java
I believe you're overlooking something, as the two ports are not identical. :-)
A minor difference is MyAdapter.GetChildId(), which uses '+' in C# and '-' in Java:
return (groupPosition * _groups.Count) + childPosition;
return (groupPosition * _groups.size()) - childPosition;
That's not the problem, though. The problem is MyAdapter.GetChildView():
public override View GetChildView(int groupPosition, int childPosition, bool isLastChild, View convertView, ViewGroup parent)
var view = (TextView)(convertView ?? new TextView(_context));
view.Text = _groups[groupPosition].Items[childPosition];
view.Click += delegate
Toast.MakeText(_context, "Item clicked", ToastLength.Short).Show();
Specifically, the `view.Click` event registration is the problem, and the Java code has no equivalent statement. Remove the view.Click event registration, and I get the "In OnChildClick" messages.