Advertisement
Guest User

Untitled

a guest
Jan 12th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. public Bitmap getBitmapfromUrl(String imageUrl) {
  2. try {
  3. URL url = new URL(imageUrl);
  4. HttpURLConnection connection = (HttpURLConnection) url.openConnection();
  5. connection.setDoInput(true);
  6. connection.connect();
  7. InputStream input = connection.getInputStream();
  8. Bitmap bitmap = BitmapFactory.decodeStream(input);
  9. return bitmap;
  10. } catch (Exception e) {
  11. e.printStackTrace();
  12. return null;
  13.  
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement