Java tutorial
//package com.java2s; // License: https://servicestack.net/bsd-license.txt import android.graphics.Bitmap; import android.graphics.BitmapFactory; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; public class Main { public static Bitmap readBitmap(HttpURLConnection response) { try { return readBitmap(response.getInputStream()); } catch (IOException e) { throw new RuntimeException(e); } } public static Bitmap readBitmap(InputStream stream) { return BitmapFactory.decodeStream(stream); } public static Bitmap readBitmap(byte[] bytes) { return BitmapFactory.decodeByteArray(bytes, 0, bytes.length); } }