Android Custom UI Component with Generic Type

1 week ago 2
ARTICLE AD BOX

I have created a custom spinner in Java for Android and my class uses generics as such

public class TLPSpinner<T> {

I have an event that fires when a object is selected and if instantiate the control in code I can specify the type for like this

private TLPSpinner<Month> monthSpinner;

However, I am using view binding so if I call the method to set the list items on the control I get a warning

Unchecked call to 'setListItems(T[])' as a member of raw type 'com.tlpsoftware.ui.TLPSpinner'

What I'm wondering is, is there a way to add this class type to the XML so I don't get that warning? And the code checks enforce the correct data type?

Read Entire Article