Code example for ByteBuffer

Methods: put, rewind

0
		/* Camera preview delegate callback */ 
		@Override 
		public void onPreviewFrame(byte[] data, Camera camera) {
			if (waitingNextPreviewFrame)
			{ 
				previewBuffer.rewind();
				previewBuffer.put(data);
				waitingNextPreviewFrame = false;
			} 
		} 
 
		/* Take picture */ 
		private void doSnap() { 
			Log.i(TAG, "Snap current image");
			if (cam != null && !pauseMode && !darkMode)
			{ 
				try { 
					handler.sendEmptyMessage(MSG_DO_AUTO_FOCUS);
				} 
				catch (Exception e) { e.printStackTrace(); }
			}