コード例 #1
0
  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;
  }
コード例 #2
0
 public SerializingRunnable(Bitmap b, Handler h) {
   mHandler = h;
   mData = new SearchPredictData();
   mData.setBitmap(b);
 }