Skip to content

Instantly share code, notes, and snippets.

@sanjogshrestha
Created November 21, 2017 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sanjogshrestha/f38fa718fdb1a6fd064b25ee2ab6b089 to your computer and use it in GitHub Desktop.
Save sanjogshrestha/f38fa718fdb1a6fd064b25ee2ab6b089 to your computer and use it in GitHub Desktop.
async doInBackground for ImageDownloader()
@Override
protected Bitmap doInBackground(String... strings) {
Bitmap bitmap = null;
InputStream inputStream;
try {
// Download Image from URL
inputStream = new URL(strings[0]).openStream();
// Decode Bitmap
bitmap = BitmapFactory.decodeStream(inputStream);
} catch (Exception e) {
e.printStackTrace();
}
return bitmap;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment