Bug 5281 - BaseExpandableListAdapter inheritor
Summary: BaseExpandableListAdapter inheritor
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.2.x
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-05-23 11:36 UTC by Maxim
Modified: 2012-06-01 11: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 Maxim 2012-05-23 11:36:41 UTC
Cause there are no initial response to https://bugzilla.xamarin.com/show_bug.cgi?id=5198, i tried to replace SimpleExpandableListAdapter with my own BaseExpandableListAdapter inheritor.

I implemented my inheritor in the same file as other BaseAdapter inheritors, which are work now with no issue.

With BaseExpandableListAdapter inheritor I got this:
D/AndroidRuntime(  967): Shutting down VM
E/AndroidRuntime(  967): FATAL EXCEPTION: main
E/AndroidRuntime(  967): java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams
E/AndroidRuntime(  967): 	at android.widget.ListView.setupChild(ListView.java:1779)
E/AndroidRuntime(  967): 	at android.widget.ListView.makeAndAddView(ListView.java:1748)
E/AndroidRuntime(  967): 	at android.widget.ListView.fillDown(ListView.java:670)
E/AndroidRuntime(  967): 	at android.widget.ListView.fillFromTop(ListView.java:727)
E/AndroidRuntime(  967): 	at android.widget.ListView.layoutChildren(ListView.java:1598)
E/AndroidRuntime(  967): 	at android.widget.AbsListView.onLayout(AbsListView.java:1260)
E/AndroidRuntime(  967): 	at android.view.View.layout(View.java:7175)
E/AndroidRuntime(  967): 	at android.widget.AbsoluteLayout.onLayout(AbsoluteLayout.java:120)
E/AndroidRuntime(  967): 	at android.view.View.layout(View.java:7175)
E/AndroidRuntime(  967): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
E/AndroidRuntime(  967): 	at android.view.View.layout(View.java:7175)
E/AndroidRuntime(  967): 	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
E/AndroidRuntime(  967): 	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
E/AndroidRuntime(  967): 	at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
E/AndroidRuntime(  967): 	at android.view.View.layout(View.java:7175)
E/AndroidRuntime(  967): 	at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
E/AndroidRuntime(  967): 	at android.view.View.layout(View.java:7175)
E/AndroidRuntime(  967): 	at android.view.ViewRoot.performTraversals(ViewRoot.java:1140)
E/AndroidRuntime(  967): 	at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
E/AndroidRuntime(  967): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(  967): 	at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  967): 	at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime(  967): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  967): 	at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(  967): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime(  967): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime(  967): 	at dalvik.system.NativeStart.main(Native Method)

Is it correct?
Comment 1 Jonathan Pryor 2012-05-29 16:48:05 UTC
This likewise is probably a duplicate of #5122, though BaseExpandableListAdapter doesn't have any IList<IDictionary<string, object>> parameters, so your implementation comes into play.

Does using JavaList/JavaDictionary fix your issue? If not, can you attach a test case including your BaseExpandableListAdapter subclass for diagnosis?

 - Jon

*** This bug has been marked as a duplicate of bug 5122 ***
Comment 2 Maxim 2012-05-30 02:22:31 UTC
Surely, I tried JavaList/JavaDictionary fix with no luck.
I'll attach sample code and we will continue.
Comment 3 Maxim 2012-05-30 09:53:24 UTC
Could you make a snippet code how to declare JavaList/JavaDictionary beforehand using it?
I mean how not to use "Implicitly Typed Local Variables" (http://msdn.microsoft.com/en-us/library/bb384061.aspx).
Comment 4 Jonathan Pryor 2012-06-01 11:55:13 UTC
Just replace `var` with the full type on the right-hand-side. For example, consider: http://stackoverflow.com/a/8680101/83444

> using (var childData = new JavaList<IList<IDictionary<string, object>>> ()) {

This could instead be:

> using (JavaList<IList<IDictionary<string, object>>> childData = new JavaList<IList<IDictionary<string, object>>> ()) {