Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public static Bitmap DownloadImageBitmap(String url) {
Bitmap bm = null;
try {
URL aURL = new URL(url);
URLConnection conn = aURL.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
bm = BitmapFactory.decodeStream(bis);
bis.close();
is.close();
} catch (IOException e) {
Log.e("IMAGE", "Error getting bitmap", e);
}
return bm;
}
@alimogh
Copy link

alimogh commented Jun 27, 2021

imports?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment