powered by Jive Software

GTalk - how to get the avatar?

Hi,

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.

Fanilo.

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,

regards,

Look at VCard javadoc, has all the info.

waf.