I'm trying to convert String
into Bitmap
object to put it then on ImageView
. String
value is downloaded from web and is not null. Actually it is a jpeg file which I can download and open via browser.
I tried to use BitmapFactory.decodeByteArray
method but got --- SkImageDecoder::Factory returned null
message.
try{
byte[] encodeByte = encodedString.getBytes();
Bitmap bitmap = BitmapFactory.decodeByteArray(encodeByte, 0, encodeByte.length);
return bitmap;
} catch(Exception e){
e.printStackTrace();
return null;
}
encodedString
is actually a string I downloaded before:
...
HttpEntity resEntity = response.getEntity();
String encodedString = EntityUtils.toString(resEntity);
...