I'm trying to get the profile image from fb but it returns the following error
java.io.FileNotFoundException: No content provider: link
My code is like this
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);
Class preference method getUserPhoto
public static String getUserPhoto(Context c){
SharedPreferences prefs = c.getSharedPreferences("myPref", 0);
return prefs.getString("url", "url");
}
My url is that
url: link
Meditating to take 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;
}
}
Bitmap and drawable result
TempBitMap null drawable android.graphics.drawable.BitmapDrawable@22b0eb58