David Brown
David Brown

Reputation: 4823

Multiple ListView Example

I am working on an application where I have to display the list of songs in an Activity. I know I can do that using the ListView but actually the problem is that I want to display them in a Particular Manner.

I want to display them AS PER THE ARTISTS NAME. i.e. I WANT TO DISPLAY THE MULTIPLE SONGS OF A PARTICULAR ARTIST IN ONE ROW AND SIMILARLY THE OTHER BELOW THE ONE.

IN THE LIST VIEW FIRST NAME IS SUPPOSED TO BE THE NAME OF THE ARTIST THEN THE LIST OF HIS SONGS, AGAIN THE NAME OF THE SECOND ARTIST AND HIS LIST OF SONGS BELOW HIS NAME AND SO ON.

Can anyone please help me on this.

Thanks, david

Upvotes: 1

Views: 1336

Answers (2)

j3ffz
j3ffz

Reputation: 715

Why not use expandable lists?

Check out: ExpandableList1.java

alt text

Upvotes: 3

mreichelt
mreichelt

Reputation: 12455

Basically it is not a good idea to use multiple ListViews here. One method would be to use multiple rows in the ListView (and use different types for the rows, which ListView supports). The other method would be to inflate a whole LinearLayout/RelativeLayout as a view and put your children there. I would recommend the first one - multiple rows, different types.

Upvotes: 0

Related Questions