简体   繁体   中英

How can I obtain my profile picture from Google Talk using smack API?

How can I get my profile picture from my Google Talk profile using Smack API or any other API. I tried using VCards but it does not work. I obtain only an XML representation of the users profile: FirstName LastName.

I found a solution. It seems that I cannot take the avatar picture only on the roster listener. This means that only when the presence changes you can see user's Presence.Type and can get it's avatar, but other data about his profile cannot be taken. If anyone knows why or has a solution I would be very happy to see what he has in mind.

try this it work complete.

try {
                    vCard.load(connection, entry.getUser());
                    vCard.getExtensions();
                    byte[] b = vCard.getAvatar();
                    Bitmap avatar = BitmapFactory.decodeByteArray(vCard.getAvatar(), 0, b.length);
                } catch (Exception e) {
                    Log.e("EXP-Image", "Not valid code");
                }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM