如何让我的Andr​​oid应用程序Facebook的个人资料图片? [英] how to get the facebook profile picture in my android application?

查看:103
本文介绍了如何让我的Andr​​oid应用程序Facebook的个人资料图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在开发一个Android的应用程序中,我必须让 Facebook的照片在我的应用程序。

I am developing a application in android in which i have to get the facebook photo in to my application.

是否有可能在Android的?

Is it possible in android?

请帮我。

感谢和问候, durgesh Limbani

Thanks and Regards, durgesh Limbani

推荐答案

所有你需要的是用户的用户ID,那么你可以调用这样的功能:

All you need is the user ID for the user, then you can call a function like this:

/**
 * Function loads the users facebook profile pic
 * 
 * @param userID
 */
public Bitmap getUserPic(String userID) {
    String imageURL;
    Bitmap bitmap = null;
    Log.d(TAG, "Loading Picture");
    imageURL = "http://graph.facebook.com/"+userID+"/picture?type=small";
    try {
        bitmap = BitmapFactory.decodeStream((InputStream)new URL(imageURL).getContent());
    } catch (Exception e) {
        Log.d("TAG", "Loading Picture FAILED");
        e.printStackTrace();
    }
    return bitmap;
}

您可以在IMAGEURL类型更改为得到不同尺寸的图片。

You can change the type in the imageURL to get different size pictures.

这篇关于如何让我的Andr​​oid应用程序Facebook的个人资料图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆