I want to get the facebook profile picture, but it returns me Bitmap null. Why? The debug I get this: Bitmap b = getUserPic (user IDs); b: null byte [] image = convertBitmapToByteArray (b); image: null
public void displayWelcomeMessage(Profile profile){
if (profile != null){
//mTextDetails.setText("Welcome "+ profile.getName());
databaseHelper = new Database(getActivity());
String name = profile.getName();
String idade = profile.getLastName();
String userIds = profile.getId();
Bitmap b = getUserPic(userIds);
byte[] image = convertBitmapToByteArray(b);
long id = databaseHelper.insertData(name, idade, image);
if(id < 0){
Message.message(getActivity(), "Unsuccessful");
} else{
Message.message(getActivity(), "Successfully Inserted a Row");
}
}
}
public Bitmap getUserPic(String userID) {
String imageURL;
Bitmap bitmap = null;
//Log.d(TAG, "Loading Picture");
imageURL = "https://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;
}