Pixate / Xamarin-PixateFreestyle

Xamarin.iOS and .Android module for Pixate Freestyle
Apache License 2.0
53 stars 22 forks source link

PXHierarchyListener issue. #11

Closed gerasim13 closed 2 years ago

gerasim13 commented 10 years ago

Hello. I'm having problem with Xamarin module on Android platform. My app uses ExpandableListView and when i try SetAdapter(myAdapter) app crashes. Here is log:

[AndroidRuntime] Shutting down VM [AndroidRuntime] FATAL EXCEPTION: main [AndroidRuntime] Process: Telesite.Telesite, PID: 4366 [AndroidRuntime] java.lang.RuntimeException: For ExpandableListView, use setAdapter(ExpandableListAdapter) instead of setAdapter(ListAdapter) [AndroidRuntime] at android.widget.ExpandableListView.setAdapter(ExpandableListView.java:552) [AndroidRuntime] at android.widget.ExpandableListView.setAdapter(ExpandableListView.java:86) [AndroidRuntime] at com.pixate.freestyle.PXHierarchyListener.setAdapterProxy(PXHierarchyListener.java:258) [AndroidRuntime] at com.pixate.freestyle.PXHierarchyListener.access$300(PXHierarchyListener.java:46) [AndroidRuntime] at com.pixate.freestyle.PXHierarchyListener$PXLayoutListener.onGlobalLayout(PXHierarchyListener.java:302) [AndroidRuntime] at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:815) [AndroidRuntime] at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1782) [AndroidRuntime] at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000) [AndroidRuntime] at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670) [AndroidRuntime] at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761) [AndroidRuntime] at android.view.Choreographer.doCallbacks(Choreographer.java:574) [AndroidRuntime] at android.view.Choreographer.doFrame(Choreographer.java:544) [AndroidRuntime] at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747) [AndroidRuntime] at android.os.Handler.handleCallback(Handler.java:733) [AndroidRuntime] at android.os.Handler.dispatchMessage(Handler.java:95) [AndroidRuntime] at android.os.Looper.loop(Looper.java:136) [AndroidRuntime] at android.app.ActivityThread.main(ActivityThread.java:5017) [AndroidRuntime] at java.lang.reflect.Method.invokeNative(Native Method) [AndroidRuntime] at java.lang.reflect.Method.invoke(Method.java:515) [AndroidRuntime] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) [AndroidRuntime] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) [AndroidRuntime] at dalvik.system.NativeStart.main(Native Method)

Shalom commented 10 years ago

I'll take a look. Seems like we need to make a change in the way we proxy the list adapter.

gerasim13 commented 10 years ago

thanks!

gerasim13 commented 10 years ago

Hello. Any news on this issue?

Shalom commented 10 years ago

Some news. Yes. I did some investigation and started the work for supporting this AdapterView. For some reason, the creator of the ExpandableListView class basically broke the standard API for AdapterViews. Adding a 'regular' Adapter throws an exception, and it actually expects an ExpandableListAdapter implementation (which does not even extends from the Adapter interface). So... for freestyle, it means a special support. This work will take some time to complete, but for now I've pushed a patch to the code here that will prevent the app from crashing when it sees an ExpandableListView. Not styling it, but at least not crashing.

I'm keeping this issue open until it's done.

thanks!

gerasim13 commented 10 years ago

Thanks! Can you apply this patch to Xamarin-PixateFreestyle module?