powered by Jive Software

GTalk - how to get the avatar?


I use the smack library for a Gtalk client.

How can I get the users avatars ? images ?

The users (contacts) ara managed by the Roster class,

but Roster and RosterEntry don’t provide anything about the users’ images.

Thank you.


After successful login:

VCard vcard = new VCard();

vcard.load(connection,"theperson@gmail.com"); // load someone’s VCard

byte[] avatarBytes = vcard.getAvatar();
ImageIcon icon = new ImageIcon(avatarBytes);
JOptionPane.showMessageDialog(null, icon);

If icon is null, means the user hadnt set avator,


Look at VCard javadoc, has all the info.