Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save skayred/1339038 to your computer and use it in GitHub Desktop.
Out loader
public static Bitmap fetchImage(String url) {
URL fileUrl = null;
try {
fileUrl = new URL(url);
} catch (MalformedURLException exc) {
return null;
}
try {
HttpURLConnection conn = (HttpURLConnection) fileUrl.openConnection();
conn.setDoInput(true);
conn.connect();
InputStream is = conn.getInputStream();
return BitmapFactory.decodeStream(is);
} catch (IOException exc) {
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment