Android - Facebook-Profilbild abrufen

Ich weiß nicht warum, aber ich erhalte immer null, wenn ich versuche, das Profilbild des Benutzers zu erhalten. Muss ich bestimmte Berechtigungen festlegen, um Zugriff zu erhalten?

Unten ist meine Methode:

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";
   InputStream in = (InputStream) new URL(imageURL).getContent();
   bitmap = BitmapFactory.decodeStream(in);

   return bitmap;
}

Bitmap bitmap = getFacebookProfilePicture(userId);

Ich werde null. Ich weiß nicht warum? Jede Hilfe ist spürbar.

Antworten auf die Frage(28)

Ihre Antwort auf die Frage