Skip to main content
edited tags
Link
Noman Malik
  • 87
  • 3
  • 5
  • 18
Source Link
Noman Malik
  • 87
  • 3
  • 5
  • 18

How to dynamically add multiple array-list in a List

I want to add multiple array-list in a list and display in list-view using custom adapter with section. i have tried here is my code i tried

   for (int i=0;i<mModelJsoncatData.size();i++){
                if (mModelJsoncatData.get(i).getCatName().equals("Eating")) {
                    ListAll.add(new String(mModelJsoncatData.get(i).getCatName()));
                    ListAll.addAll(mModelJsonEating);
                }
                if (mModelJsoncatData.get(i).getCatName().equals("Feeling")) {
                    ListAll.add(new String(mModelJsoncatData.get(i).getCatName()));
                    ListAll.addAll(mModelJsonFeeling);
                }
                if (mModelJsoncatData.get(i).getCatName().equals("Listening to")) {
                    ListAll.add(new String(mModelJsoncatData.get(i).getCatName()));
                    ListAll.addAll(mModelJsonListening);
                }
                if (mModelJsoncatData.get(i).getCatName().equals("Watching")) {
                    ListAll.add(new String(mModelJsoncatData.get(i).getCatName()));
                    ListAll.addAll(mModelJsonWatching);
                }
            }
MAdapter adapter=new MAdapter(this,ListAll);
listview1.setAdapter(adapter); 

but its not showing the desired results any suggestions or help needed