Skip to content

Instantly share code, notes, and snippets.

@Suleiman19
Created January 7, 2016 00:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Suleiman19/6da9be86f4f9714b9650 to your computer and use it in GitHub Desktop.
Save Suleiman19/6da9be86f4f9714b9650 to your computer and use it in GitHub Desktop.
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