How to best load and setup the roster?

Hi,

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

I see two options:

1.)

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.

2.)

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?