Processing IQ Packet with Roster Items

Hello,

Is there anyone who can give me a quick pointer on how to access the rosterItems contained within an IQ packet? Scenario is thus:

  1. Perform connection.login()

Send an IQ packet to request roster:

Receive an IQ packet in response

  1. Smack converts this response into an IQ packet. The packet contains a private Collection of PacketExtensions, which is empty, and a private ArrayList of Items that contains all of the roster items. How do I access the roster items?

Thanks in advance!

Finally found the answer to this question right after I posted it:

@Override
public void processPacket(Packet packet) {
   if (packet instanceof RosterPacket) {
      RosterPacket rosterPacket = (RosterPacket) packet;       for (Item rosterItem : rosterPacket.getRosterItems()) {
         // do something
      }
   }
}

Did you have already a look on my RosterDemo?