I want to be able to create ArrayList of unknown type in order to fill spinner
I have the following method, but I missed the correct syntax type..
I need to pass it the class type (for example "Person"), the spinner id and the array of the classes ("Person[]").
private void fillSpinner(Class clss, int id, Class[] c_array) {
List<clss> list = new ArrayList<clss>();
for (clss c : c_array) {
list.add(c);
}
}
the c_array type should be the type of clss.
for example - calling to this methos should be:
Person[] persons = ....
fillSpinner(Person, R.id.person_spinner, persons)
What am I missing?
Thanks.