Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import android.util.Log; import java.io.ByteArrayOutputStream; public class Main { private static final String LOG_TAG = "watch_utility"; private static byte[] createByteArrayFromBitmap(Bitmap bitmap) { Log.e(LOG_TAG, "creating asset"); final ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteStream); Log.e(LOG_TAG, "length : " + Integer.toString(byteStream.toByteArray().length)); return byteStream.toByteArray(); } }