Created
November 21, 2017 08:47
-
-
Save sanjogshrestha/f38fa718fdb1a6fd064b25ee2ab6b089 to your computer and use it in GitHub Desktop.
async doInBackground for ImageDownloader()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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