get Bytes from PNG Bitmap - Android android.graphics

Android examples for android.graphics:PNG

Description

get Bytes from PNG Bitmap

Demo Code

import java.io.ByteArrayOutputStream;

import android.graphics.Bitmap;

public class Main {

  public static byte[] getBytes(Bitmap bitmap) {
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.PNG, 0, stream);
    return stream.toByteArray();
  }/*from  www .ja  v a  2 s  . co m*/

}

Related Tutorials