-3

我正在制作一个 android 应用程序,作为其中的一部分,我需要将我所有的 FB 朋友与他们的个人资料图片放在一个列表中。谁能帮我解决这个问题?

4

1 回答 1

1

这是一个关于如何做到这一点的很棒的教程:教程 你必须将parse集成到你的应用程序中。获得所有朋友 fbId 的列表后,您可以像这样简单地获取他们的个人资料图片:

public static final String TYPE_SMALL = "small";
    public static final String TYPE_MEDIUM = "normal";
    public static final String TYPE_LARGE = "large";

public static Bitmap getProfilePicture(String id, String type) {
        URL img_value = null;
        Bitmap profilePicture = null;
        try {
            img_value = new URL("http://graph.facebook.com/"+id+"/picture?type=" + type);
            profilePicture = BitmapFactory.decodeStream(img_value.openConnection().getInputStream());

        } 
        catch (MalformedURLException e) {
            e.printStackTrace();
            Log.d("SpaceDroid", "MalformedURLException");

        } 
        catch (IOException e) {
            e.printStackTrace();
            Log.d("SpaceDroid", "IOException");

        }

        return profilePicture;

    }

我希望这能让你开始!

于 2012-08-01T09:44:34.573 回答