How to get images from xmpp in android app

I am working on android contacts app. I am using XMPP to get buddy name, status. I need to get the image of a buddy. How can I achieve this? I am using a custom adapter to display content. Please guide me in the dropdown user image from xmpp in the list.

thank

+3


source to share


1 answer


Here's how to get all the info about a buddy



Roster roster = XMPPConnection.getRoster();
            Collection<RosterEntry> entries= roster.getEntries();
            ProviderManager.getInstance().addIQProvider("vCard", "vcard-temp",
                    new VCardProvider());
            VCard card = null;
            for (RosterEntry entry : entries) {
                card = new VCard();
                Presence presencek= roster.getPresence(entry.getUser());
                try {
                    card.load(Main.conn, entry.getUser());
                } catch (Exception e) {
                    e.printStackTrace();
                }

                String jid = entry.getUser();
                 String name = card.getField("FN");
                String status = presencek.getType().name();
                Log.d("Prescence", "" + presencek.getType().name());// //num one log

                byte[] imgs = card.getAvatar();
                if (imgs != null) {
                    int len = imgs.length;
                    Bitmap img = BitmapFactory.decodeByteArray(imgs, 0, len);
                }

      

+6


source







All Articles