I have code that loads a png file from a url into a ByteArrayOutputStream. Now I want to make this into a bitmap so I can draw it. I tried Bitmap bBack=BitmapFactory.decodeStream(output);, but BitMapFactory will not take in a yteArrayOutputStream.
How can I creat a bitmap from a ByteArrayOutputStream object?, code
try {
URL url = new URL("http://stage.master.embryooptions.healthbanks.com/siteassets/24/ShadyGrove-logo.png");
InputStream is = (InputStream) url.getContent();
byte[] buffer = new byte[8192];
int bytesRead;
ByteArrayOutputStream output = new ByteArrayOutputStream();
while ((bytesRead = is.read(buffer)) != -1) {
output.write(buffer, 0, bytesRead);
}
/////////////////////////////////////////////////////////////////////////////
// HOW DO I GET A BITMAP?????????
///////////////////////////////////////////////////////////////////////////////
// Bitmap bBack=BitmapFactory.decodeStream(output);
return "";
} catch (MalformedURLException e) {
e.printStackTrace();
return null;
} catch (IOException e) {
e.printStackTrace();
return null;
}