I am trying to get the Bitmap from a URL from the StaticConfig.getMyUser().getAvatar()
. The url is as follows "https://lh6.googleusercontent.com/-0feEeEohl8I/AAAAAAAAAAI/AAAAAAAAAGA/htLteFBdk5M/s96-c/photo.jpg"
.
When I use the code below, src
is null. I'm not sure why. I am currently looking into this link but I'm still clueless to what I should do.
private void setImageAvatar(Context context){
Resources res = getResources();
Bitmap src;
byte[] decodedString = Base64.decode(StaticConfig.getMyUser().getAvatar(), Base64.DEFAULT);
src = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
if(src == null){
Log.e("UserProf","src is null");
}
// code to do something with src here
}