Skip to content

Instantly share code, notes, and snippets.

@skayred
Created November 4, 2011 10:10
Show Gist options
  • Select an option

  • Save skayred/1339036 to your computer and use it in GitHub Desktop.

Select an option

Save skayred/1339036 to your computer and use it in GitHub Desktop.
Uber loading
public static Bitmap loadImage(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("photo.get", e.getMessage());
}
return bm;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment