Reputation: 11617
When I read the API doc, I found 2 weird constructor in ArrayAdapter class:
public ArrayAdapter (Context context, int textViewResourceId)
public ArrayAdapter (Context context, int resource, int textViewResourceId)
There is no List or Array to insert into this 2 public constructor (the rest has), then what are the purpose to have these 2 constructor? How to use them?
Upvotes: 1
Views: 120
Reputation: 1855
These two constructors are for initialization of ArrayAdapter if you donnot have any Array to display at the time of object creation. Once you create/receive your array you can use
public void addAll (Collection<? extends T> collection)
to set an array to be displayed.
Upvotes: 1
Reputation: 4104
In this case you can use methods getItemViewType(int position) and getViewTypeCount() in your subclass of ArrayAdapter and List or Array of items should be a populated class field.
Upvotes: 0