Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.Bitmap;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

import java.io.InputStream;

public class Main {
    public static InputStream getInputStreamFromBitmap(Bitmap bitmap) {
        final ByteArrayOutputStream out = new ByteArrayOutputStream();
        bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
        final byte[] bitmapdata = out.toByteArray();
        final ByteArrayInputStream bs = new ByteArrayInputStream(bitmapdata);
        return bs;
    }
}