I don\'t know why, but I am always getting null when I try to get the profile picture of the user. Do I need to set some specific permissions to get access?
Below is
public static Bitmap getFacebookProfilePicture(String userID)
throws SocketException, SocketTimeoutException,
MalformedURLException, IOException, Exception {
String imageURL;
Bitmap bitmap = null;
imageURL = "http://graph.facebook.com/" + userID
+ "/picture?type=large";
URL url1 = new URL(imageURL);
HttpURLConnection ucon1 = (HttpURLConnection) url1.openConnection();
ucon1.setInstanceFollowRedirects(false);
URL secondURL1 = new URL(ucon1.getHeaderField("Location"));
InputStream in = (InputStream) new URL(imageURL).getContent();
bitmap = BitmapFactory.decodeStream(in);
return bitmap;
}
use this code.....