-4

I want to display a list inside a list in android . what will be the best way to do it. Please help with some example. I have tried using calling an adapter class from adapter(header).

  • Go for expandablelistview. – GrIsHu Jul 21 '15 at 11:15
  • My requirements will not go for expandableListView. Please suggest me something else. – sakshi Agrawal Jul 21 '15 at 11:16
  • @sakshiAgrawal then explain your requirements in the question to make it more clear. Otherwise, you'll just get expandablelistview answers and others like "Don't do it" – d0nut Jul 21 '15 at 11:17
  • what do you want to do exactly?? I guess expandable listview should do the trick.because using a scroll able content inside another scroll-able content is bad habit. – Khushal Chouhan Jul 21 '15 at 11:20
  • I am creating a cart(sort of). I have to display the items grouped by the store name. I have to display the store name and store total price as a heading and the items for that store as a sub category. Plus I have two buttons of '+' and '-' to add the quantity of the item. – sakshi Agrawal Jul 21 '15 at 11:22
  • can you add a screenshot in your question? – Khushal Chouhan Jul 21 '15 at 11:24
  • okay I got it. try this http://stackoverflow.com/questions/25102519/add-headers-in-a-listview-using-arrayadapter – Khushal Chouhan Jul 21 '15 at 11:29
  • Please take some time to read the [help page](http://stackoverflow.com/help), especially the sections named "What topics can I ask about here?" and "What types of questions should I avoid asking?". And more importantly, please read the [Stack Overflow question checklist](http://meta.stackoverflow.com/questions/260648/stack-overflow-question-checklist). You might also want to learn about [Minimal, Complete, and Verifiable Examples](http://stackoverflow.com/help/mcve). – galath Jul 25 '15 at 07:33

3 Answers3

1

It seems like you are trying to develop expandable list view.

Here is sample of it

Kinnar Vasa
  • 397
  • 1
  • 9
0

this effects when it comes to performance of the list view... the solution is to infliate a new listview inside the main listView, you can do this inside adapters getView method

here is the link - android: listview in listview

Community
  • 1
  • 1
0

Take a LinearLayout in XML and and make another view for row which you want to add and then inflate row and add to linearlayout.

Ashish Agrawal
  • 1,977
  • 2
  • 18
  • 32
  • This is a good suggestion, just to add to it, the data structure that we send to the Adapter will look like ArrayList> and also some one else has already done all the complex stuff using expandable list view. So I feel it is better to use that. – Sreekanth Karumanaghat Sep 25 '17 at 07:44