Code example for ByteArrayOutputStream

Methods: sizetoByteArray

0
		System.gc(); 
		Bitmap b = null;
		Size s = parameters.getPreviewSize();
 
		YuvImage yuvimage = new YuvImage(buffer, ImageFormat.NV21, s.width, s.height, null);
		ByteArrayOutputStream outStream = new ByteArrayOutputStream();
		yuvimage.compressToJpeg(new Rect(x, y, width, height), 100, outStream); // make JPG
		b = BitmapFactory.decodeByteArray(outStream.toByteArray(), 0, outStream.size()); // decode JPG
		yuvimage = null;
		outStream = null;
		System.gc();
		return b;
	} 
	 
	private void updateBufferSize() { 
		buffer = null;
		System.gc();
		// prepare a buffer for copying preview data to 
		int h = camera.getParameters().getPreviewSize().height;
		int w = camera.getParameters().getPreviewSize().width;
Connect your IDE to all the code out there  Get Codota for Java