lamaen
lamaen

Reputation: 15

Creating list consisting of lists (Android)

I'm in this situation that i need a list of lists.

for instance i want to display a list of departments and in these departments there are employees:

Dep 1:

Employee 1
...
Employee N-1

Dep ...

Dep N - 1:

Employee 1
...
Employee N-1

any idea how to make this? (sorry for the bad english)

Upvotes: 1

Views: 1950

Answers (4)

hoeggi
hoeggi

Reputation: 125

  1. you can have a list with your departments and if one of the departments is clicked you just open a new Activity/show a new Fragment with the corresponding list of employees.

  2. try an expandable listview, there is a good example in the api-demos

Upvotes: 1

Rahul garg
Rahul garg

Reputation: 9362

are you talking about an android ListView inside another listview

read about custom list adapter.. and find there you can paas list of departments in there..which would populate single view in getView() as list(custom list adapter by passing employees list) of employees in it.... but make sure if this flow on user screen will be acceptable to you or not...i.e. list view inside a list view... might be little confusing from user's perspective

Upvotes: 1

5hssba
5hssba

Reputation: 8079

You should try this by implementing an Expandable ListView.. Refer this link

Upvotes: 1

Asdfg
Asdfg

Reputation: 12273

what you need is custom list adapter or you can use ExpandableListView widget.

Upvotes: 1

Related Questions