@Override public void onClick(View v) { switch (v.getId()) { case R.id.take_photo_fragment_take_photo_btn: cameraManager.takePhoto(new PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) { Bitmap bitmap = BitmapUtil.toBitmap(data); BitmapUtil.saveBitmapToFile(bitmap, Environment.getInstance().getMyDir() + "/" + new Date().getTime() + ".jpg", CompressFormat.JPEG); Bundle bundle = new Bundle(); bundle.putParcelable("bitmap", bitmap); setResult(bundle); cameraManager.restartPreview(); } }); break; default: break; } }
public void requestTakePicture( final ShutterCallback shutter, final PictureCallback raw, final PictureCallback postView, final PictureCallback jpeg) { post(new Runnable() { @Override public void run() { try { mCamera.takePicture(shutter, raw, postView, jpeg); } catch (RuntimeException e) { // TODO: output camera state and focus state for debugging. Log.e(TAG, "take picture failed."); throw e; } } }); }
public void take_picture(String filename, PictureCallback callback) { picture_filename = filename; picture_callback = callback; mCamera.setPreviewCallback(null); updateOrientation(); final CornerDetectionView this_ref=this; mCamera.autoFocus(new Camera.AutoFocusCallback() { @Override public void onAutoFocus(boolean success, Camera cam) { cam.takePicture(null, null, null, this_ref); } }); }
public void takePicture(final String fileName) { Log.i(TAG, "Tacking picture"); PictureCallback callback = new PictureCallback() { private String mPictureFileName = fileName; @Override public void onPictureTaken(byte[] data, Camera camera) { Log.i(TAG, "Saving a bitmap to file"); Bitmap picture = BitmapFactory.decodeByteArray(data, 0, data.length); try { FileOutputStream out = new FileOutputStream(mPictureFileName); picture.compress(Bitmap.CompressFormat.JPEG, 90, out); picture.recycle(); mCamera.startPreview(); } catch (Exception e) { e.printStackTrace(); } } }; mCamera.takePicture(null, null, callback); }
public void takePhoto(PictureCallback jpeg) { DebugLog.d(TAG, "takePhoto()"); if (camera != null) { camera.takePicture(null, null, jpeg); } }
private void takePicture() { mCamera.takePicture( null, null, new PictureCallback() { @Override public void onPictureTaken(final byte[] jpegData, Camera camera) { final Camera.Size size = camera.getParameters().getPictureSize(); Log.i(TAG, "Captured JPEG " + jpegData.length + " bytes (" + size.width + "x" + size.height + ")"); if (mImageListener != null) { mCallbackHandler.post( new Runnable() { @Override public void run() { mImageListener.onJpegImageAvailable(jpegData, size.width, size.height); } } ); } if (mContinueTakingPictures) { mCamera.startPreview(); takePicture(); } } } ); }
@Override public void onConfigurationChanged(Configuration newConfig) { if (mCamera != null) { PictureCallback cb = new PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) {} }; mCamera.takePicture(null, null, cb); } }
public synchronized void takePicture(PictureCallback callback) { if (this.isFocused()) { try { this.camera.setPreviewCallback(null); this.camera.takePicture(this.shutterCallback, null, callback); } catch (RuntimeException re) { Log.w(TAG, "Unexpected exception while takePicture", re); } } else { this.pictureCallback = callback; this.takePicture = true; } }
private void takePicture() { PictureCallback mPicture = new PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) { new MediaSaver().execute(data); mCamera.startPreview(); } }; mCamera.takePicture(null, null, mPicture); }
public void setPictureListener(PictureCallback listener) { pictureListener = listener; }
@Override public void takePicture(PictureCallback callback, TakePictureListener listener) { mCameraView.takePicture(callback,listener); }
@Override public void takePicture(PictureCallback callback,CameraContainer.TakePictureListener listener){ mCamera.takePicture(null, null, callback); }
public void takePicture(PictureCallback callback) { if (this.mAutoFocusManager != null) { this.mAutoFocusManager.takePicture(callback); } }
public void setPictureCallback(PictureCallback pictureCallback) { this.pictureCallback = pictureCallback; }
public void takePicture(final PictureCallback jpegCallback) { if (null == camera) return; camera.takePicture(null, null, jpegCallback); }
/** * 拍照 * @param callback 拍照回调函数 * @param listener 拍照动作监听函数 */ public void takePicture(PictureCallback callback, CameraContainer.TakePictureListener listener);
public void takePicture(PictureCallback callback) { Log.i(TAG, "Taking picture"); mCamera.takePicture(null, null, callback); }