How to best load and setup the roster?


I wonder, how I the Roster should usually be loaded.

I see two options:


Do it in the RosterListener.entriesAdded.

This method seems to be called once, immediately after login and contains all addresses.

I could then call getEntry(address) for each address to get the RosterEntry, and call getGroups on each RosterEntry, to build up my groups.

Then check if a RosterEntry can be put in an existing group or make a new one.

If the group count is 0, it is unfiled and make an extra group for that.


After login call roster.getGroups() to build groups and get its entries via group.getEntries().

Use roster.getUnfiledEntries() for the unfiled entries.

The problem here is that entriedAdded is still called.

Can somebody help? What is the actual purpose of entriesAdded?