eks eks - 4 months ago 29x
Android Question

Adding a custom view to XML... but with a GENERIC-type

I am working on a custom view with a hope of reusability. It should have a generic type, like this:

public class CustomViewFlipper<someType> extends ViewFlipper { }

I know how to bind a normal custom view to the XML file. But I couldn't find any example for this situation. Is there any way to define a generic type for a class in XML?


I don't think so, but you can create your own subclass:

public class TheClassYouPutInTheLayoutFile extends CustomViewFlipper<someType>

and use that class in your layout XML.