Bug 11580 - ExpandableListView.Adapter expects IListAdapter
Summary: ExpandableListView.Adapter expects IListAdapter
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.6.x
Hardware: PC Windows
: High normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2013-04-04 08:31 UTC by Tomasz Cielecki
Modified: 2015-03-26 05:00 UTC (History)
3 users (show)

Tags:
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:
Status:
RESOLVED NOT_ON_ROADMAP

Description Tomasz Cielecki 2013-04-04 08:31:12 UTC
Having an Adapter inheriting from BaseExpandableListAdapter is not assignable to ExpandableListView's Adapter property as it is of type IListAdapter. However the SetAdapter method correctly accepts IExpandableListAdapter, which Adapter also should.

This is observed in Xamarin.Android 4.6.00049
Comment 1 Jonathan Pryor 2013-05-22 17:12:35 UTC
This isn't a bug.

ExpandableListView doesn't provide an Adapter property; the Adapter property is inherited from ListView, which provides the ListView.Adapter property.

http://androidapi.xamarin.com/?link=T%3aAndroid.Widget.ExpandableListView%2f*
http://androidapi.xamarin.com/?link=P%3aAndroid.Widget.ListView.Adapter

This is also how Android does things, after a little squinting; ExpandableListView.getAdapter() likewise returns ListAdapter, _not_ ExpandableListAdapter:

http://developer.android.com/reference/android/widget/ExpandableListView.html#getAdapter()

This is just an override of ListView.getAdapter():

http://developer.android.com/reference/android/widget/ListView.html#getAdapter()

The return type of the `get` method is preferred when binding properties.

Meanwhile, ExpandableListView.setAdapter() is overloaded to accept an ExpandableListAdapter, which is the SetAdapter(IExpandableListAdapter) method you originally noted.

http://developer.android.com/reference/android/widget/ExpandableListView.html#setAdapter(android.widget.ExpandableListAdapter)
Comment 2 Fred 2015-03-26 05:00:49 UTC
I confirm this bug. It is non-obvious behavior.
If ExpandableListView does not provide an Adapter property, then you must review your architecture. You can add root adaper interface, like as IListAdapter. Do not leave it so. It discredits you as software designers.