Add Buddy

Hi,

Im trying to add a buddy to my roster. I know I need to use createEntry of the class Roster. Can someone please show me an example to how I would construct this.

Thanks Dilip

Dilip,

Below you can find a few examples that will show you how to use #createEntry. You can also take a look at the test cases shipped in the zip file for more examples that you can even debug.

// Add a new roster entry in two groups
    roster().createEntry("peter@jivesoftware.com", "peter", new String[] {"Friends", "Family"});
    // Add a new roster entry in only one group
    roster().createEntry("stephen@jabber.org", "steve", new String[] {"Family"});
    // Add a new roster entry but keep it unfiled (no group)
    roster().createEntry("johndoe@jabber.org", "john", null);

Regards,

– Gato