private ByteArrayOutputStream convertBitmapToBytes() { try { ByteArrayOutputStream b = new ByteArrayOutputStream(4096); b.write(Serializer.serialize(mData)); // this is the scaled bitmap // TODO: recycled bitmaps cannot be compressed! How to handle this? if (mData.getBitmap() != null && DO_USE_RECYCLE) { mData.getBitmap().recycle(); } return b; } catch (IOException e) { e.printStackTrace(); } return null; }
public SerializingRunnable(Bitmap b, Handler h) { mHandler = h; mData = new SearchPredictData(); mData.setBitmap(b); }