[JDEV] smack

Matt Tucker matt at jivesoftware.com
Fri Oct 3 13:19:54 CDT 2003


I recommend that all Smack questions be posted in the Smack forum at:


The forum is quite active and you're much more likely to get a fast 
answer there.

First, I'll assume you're using the 1.2.1 Smack release. If not, I'd 
recommend upgrading. Does the getEntries method return any results for 
you? If not, you may not have any contacts in your roster. A code 
snippet for printing out all items in the roster is:

Roster roster = con.getRoster();
for (Iterator i=roster.getEntries(); i.hasNext(); ) {

The Iterator will return RosterEntry objects if you want to manipulate 
them directly. See the Javadocs for the methods to extract the name, 
groups, and XMPP address out of a roster entry object.

The Smack Javadocs are at:


You can find more info about the Roster class at:



Nicolas Avila wrote:

> hi
>     i created a conection using smack library
>     after that i get the roster and even inside it i get a Roster Group
>     now... my problem is for getting a contact
>     i tryed with getEntries() and got the Iterator...
>     now, my problem is i can't get the contact's info...
>     i truyed printing the toString() method's String... but i got 
> allmost nothing.
>     any boduy can give me a clue about what i have to do?
>         tks
>                                                 Nicolas

More information about the JDev mailing list