Domanda

I'm trying to add Pixate to our cross-platform app built with Xamarin.

In Android app I'm using custom ListView and custom adapter which implements an interface. But when the Adapter property of the list view is being set to my custom adapter its base class is Java.Lang.Object instead of BaseAdapter and does not implement the interface anymore (cast will cause an exception).

Anyone had a similar issue with Pixate ? How do I fix it ?

È stato utile?

Soluzione

I've answered to this one on the github repo, so here is a copy-paste of that.

Pixate work on AdapterViews by proxying them in order to tag the recycled views with their new position (see https://github.com/Pixate/pixate-freestyle-android/blob/master/pixate-freestyle/src/com/pixate/freestyle/PXHierarchyListener.java#L232 ). This allows us to style more complex CSS expressions, like "nth-child" on a list. Currently, that java.lang.reflect.Proxy is being created with a few known adapter interfaces, so the casting will fail if you would like to get your original BaseAdapter.

The good news is that we have a way to get to that original Adapter via PixateFreestyle.getAdapter(AdapterView view). Then you can cast to your BaseAdapter. That should not cause any problem.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top