powered by Jive Software

Create new RosterEntry


How can I add a new RosterEntry (contact) to my Roster ?

There is a function RosterGroup.addEntry(RosterEntry), but there is no constructor for RosterEntry and i found no method which creates a new RosterEntry.



kahless - I was about to ask exactly the same question…I’‘m going through the whole api source trying to find out if anything returns a RosterEntry object(but surely it can’‘t as you said there isn’'t a constructor for the object??? Or am I just v.dumb?


I found the following in the source of RosterEntry:

RosterEntry(String user, String name, XMPPConnection connection) {
        this.user = user;
        this.name = name;
        this.connection = connection;

So, we know the constructor is there, but it is currently inaccessable due to lack of “public”… Did Matt mean to leave this out?

This is definitely a problem. I’'ll file a bug and get it fixed for the next beta.



It’'s still not public. Is there a factory for creating one?

I did a search and found that the constructor was being called only from Roster.RosterPacketListener.processPacket().

Yeah, you shouldn’'t need to create a RosterEntry directly. Just use:

Roster.createEntry(String user, String name, String [] groups);