Android InputStream to Bitmap Convert toBitmap(InputStream is)

Here you can find the source of toBitmap(InputStream is)

Description

to Bitmap

Declaration

public static Bitmap toBitmap(InputStream is) throws IOException 

Method Source Code

//package com.java2s;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import java.io.*;

public class Main {

    public static Bitmap toBitmap(InputStream is) throws IOException {
        if (null == is) {
            return null;
        }//from   ww w  .java2s  .  c o  m
        return toBitmapDrawable(is).getBitmap();
    }

    public static BitmapDrawable toBitmapDrawable(InputStream is)
            throws IOException {
        BitmapDrawable bitmapDrawable = new BitmapDrawable(is);
        is.close();
        return bitmapDrawable;
    }
}

Related

  1. toBitmap(InputStream is)
  2. toBitmapDrawable(InputStream is)
  3. toBitmapDrawable(InputStream is)
  4. loadCompatibleImage(InputStream stream)