Hello!
I have in the project (for example) 4 types of data: a chair, a table, a sofa, a couch, they are all heirs to furniture class. It is necessary in one window to display a list of furniture, divided into groups (chairs, tables, etc.). For this I use ExpandableListView, and expand BaseAdapter. Prior to this, the adapter received a String and there were no problems (well, of course). Now, I want in this one adapter to send lists of objects of the above types, referring to which, I will be able to fill in subgroups. Those. looks like this:
Π‘ΡΡΠ»ΡΡ ΡΡΡΠ» 1 ΡΡΡΠ» 2 Π‘ΡΠΎΠ»Ρ ΡΡΠΎΠ» 1 ΠΠΈΠ²Π°Π½Ρ Π΄ΠΈΠ²Π°Π½ 1 .... When I used one data type I did this:
ArrayList<ArrayList<String>> groups = new ArrayList<>(); List<String> mChair= new ArrayList<>(); List<String> mTable= new ArrayList<>(); .... groups.add(mChair); groups.add(mTable); And groups in the adapter, along with the context.
And when it was necessary to display on the screen:
groups.get(groupPosition).get(childPosition)); And how now to send lists of objects to the adapter and combine them into groups.
Simply put, how can I send objects of different types to the adapter, and get the necessary data from these objects for display in the list with my list item?