how to pass arraylist of objects to populate each section heading text and its content?
Asked Answered
P

1

3

I'am using StickyGridHeaders for GridView with sections.

this library is using R.array.countries to populate GridView with provided data and extracting first letter from passed string array to create section heading.

I m trying to pass an ArrayList of objects that will contain ArrayList for sections text named as "sectionArrayList" and "contentArrayListPrivate" and "contentArrayListPublic".

Now i want to play a for loop that will play till < sectionArrayList.size and will check is there any sections then show section text and then show all contents associated with this section by contentArrayListPrivate.size and similar for others but unable to achieve my target.

Can someone please point me towards right direction how to achieve this task ?

want to achive something like:

required image

Philippeville answered 24/8, 2015 at 12:10 Comment(0)
M
0

I downloaded it and checked to solve your problem. so here is solution.

First of all that project is replaced to SuperSlim it is showing on your given link itself, so get superslim.

Then follow the example in that project to achieve it. In that example there is a file named CountryNamesAdapter.java open it, in the 37th line there i found this

final String[] countryNames = context.getResources().getStringArray(R.array.country_names);

which means the data is loaded from Array resource

replace it with

your data - convert your arraylist to string array and assign it like this

final String[] countryNames = myData.
Microsome answered 24/8, 2015 at 12:30 Comment(9)
once i m using superslim i m getting output like this in form of listview instead of gridview while once i m using the same prj i mentioned link above then i m getting gridview what the reason ? @kashif AnwarPhilippeville
In SuperSlim project i noted now by default it falls to ListView, there are options for GridView more, check their guide..Microsome
yes there is option but they have not mention how to achive GridView do u have any idea how to achieve this ?Philippeville
I have solved your problem, Why you didn't accept or vote? Don't be rude pleaseMicrosome
u did not still solve my problem the point u have mentioned here is not my solution i want like this how its working here programering.com/a/MjN0ITMwATU.htmlPhilippeville
you did not told that in question, what you asked in question is solvedMicrosome
you just asked to use ArrayList data instead of Array resource...dont be rudeMicrosome
ask another questin for what you want like this how its working here programering.com/a/MjN0ITMwATU.htmlMicrosome
Let us continue this discussion in chat.Philippeville

© 2022 - 2024 — McMap. All rights reserved.