I am working on an Android project where I need to implement a hierarchical structure using an ExpandableListView. Currently, I have implemented a two-level hierarchy: Plant → Devices. Now, I want to expand this hierarchy to include additional levels as follows:"Plant → Department-Section → Line → Devices
I want to extend my current hierarchy to support four levels: Plant → Department-Section → Line → Devices. Here's how the hierarchy should look
Plant1└── Department1-Section1├── Line1│├── Device1│└── Device2└── Line2├── Device3└── Device4└── Department2-Section2├── Line3├── Device5└── Device6
I am not sure how to structure the data and create a custom adapter that can handle this four-level hierarchy. Since ExpandableListView natively supports only two levels (Group and Child),
I need guidance on how to:
- Design a data structure to represent this hierarchy.
- Implement a custom adapter to render this hierarchy in the ExpandableListView.
- Handle nested levels like Department-Section and Line within the same framework.
I have considered using multiple ExpandableListViews or embedding a RecyclerView inside the child view for additional levels, but I'm unsure about the best approach for performance and scalability. I have not yet been able to integrate the three additional levels (Department-Section, Line, and Device)