Pessoal estou tentando pegar a imagem do perfil do fb mas retorna o seguinte erro
java.io.FileNotFoundException: No content provider: https://graph.facebook.com/--Aqui--esta--o--id--/picture?width=150&height=150
Meu código esta assim
Bitmap tempBitmap;
tempBitmap = Util.getBitmapFromURL(Preference.getUserPhoto(getApplicationContext()));
Drawable drawable = new BitmapDrawable(getResources(), tempBitmap);
System.out.println("TempBitMap "+ tempBitmap );
System.out.println("drawable "+ drawable );
aux.setIcon(drawable);
Classe preference metodo getUserPhoto
public static String getUserPhoto(Context c){
SharedPreferences prefs = c.getSharedPreferences("myPref", 0);
return prefs.getString("url", "url");
}
Minha url eh essa
url: https://graph.facebook.com/IDESTAACQUI/picture?width=150&height=150
Medoto para pegar a photo
public static Bitmap getBitmapFromURL(String src) {
try {
URL url = new URL(src);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
} catch (Exception e) {
// Log exception
return null;
}
}
Resultado do bitMap e do drawable
TempBitMap null drawable android.graphics.drawable.BitmapDrawable@22b0eb58