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 java.io.IOException;
import java.io.InputStream;

import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;

public class Main {

    public static Bitmap toBitmap(InputStream is) throws IOException {
        if (null == is)
            return null;
        return toBitmapDrawable(is).getBitmap();
    }//from www .j  ava 2 s .c  om

    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)