Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.ByteArrayOutputStream;

import android.graphics.Bitmap;

public class Main {
    public static byte[] decodeBytes(Bitmap bm) {
        if (bm == null) {
            return null;
        }
        try {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            bm.compress(Bitmap.CompressFormat.PNG, 100, baos);
            return baos.toByteArray();
        } catch (OutOfMemoryError e) {
            return null;
        }
    }
}