Java 类android.hardware.Camera.PictureCallback 实例源码

项目:Newton_for_Android_AS    文件:TakePhotoFragment.java   
@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;
    }
}
项目:nexus-camera    文件:AndroidCameraManagerImpl.java   
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;
            }
        }
    });
}
项目:MapEver    文件:CornerDetectionView.java   
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);
        }
    });
}
项目:cvRecognition    文件:Tutorial3View.java   
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);
}
项目:Newton_for_Android_AS    文件:CameraManager.java   
public void takePhoto(PictureCallback jpeg) {
    DebugLog.d(TAG, "takePhoto()");

    if (camera != null) {
        camera.takePicture(null, null, jpeg);
    }
}
项目:FastBarcodeScanner    文件:StillSequenceCamera.java   
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();
                    }
                }
            }
    );
}
项目:droidel    文件:Controller.java   
@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);
     }
   }
项目:droidel    文件:Controller.java   
@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);
     }
   }
项目:droidel    文件:Controller.java   
@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);
     }
   }
项目:droidel    文件:Controller.java   
@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);
     }
   }
项目:droidel    文件:Controller.java   
@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);
     }
   }
项目:droidel    文件:Controller.java   
@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);
     }
   }
项目:Camdroid    文件:AutoFocusManager.java   
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;
    }
}
项目:CameraActivity    文件:CameraActivity.java   
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);

}
项目:fingerblox    文件:CameraView.java   
public void setPictureListener(PictureCallback listener) {
    pictureListener = listener;
}
项目:LLApp    文件:CameraContainer.java   
@Override
public void takePicture(PictureCallback callback,
        TakePictureListener listener) {
    mCameraView.takePicture(callback,listener);
}
项目:LLApp    文件:CameraView.java   
@Override
public void takePicture(PictureCallback callback,CameraContainer.TakePictureListener listener){
    mCamera.takePicture(null, null, callback);
}
项目:Camdroid    文件:CameraPreviewView.java   
public void takePicture(PictureCallback callback) {
    if (this.mAutoFocusManager != null) {
        this.mAutoFocusManager.takePicture(callback);
    }
}
项目:NewCommunication-Android    文件:CameraManager.java   
public void setPictureCallback(PictureCallback pictureCallback) {
    this.pictureCallback = pictureCallback;
}
项目:SawimNE    文件:Preview.java   
public void takePicture(final PictureCallback jpegCallback) {
    if (null == camera) return;
    camera.takePicture(null, null, jpegCallback);
}
项目:LLApp    文件:CameraOperation.java   
/**  
 *  拍照
 *  @param callback 拍照回调函数 
 *  @param listener 拍照动作监听函数  
 */
public void takePicture(PictureCallback callback, CameraContainer.TakePictureListener listener);
项目:Document-Scanner    文件:DocumentCameraView.java   
public void takePicture(PictureCallback callback) {
    Log.i(TAG, "Taking picture");

    mCamera.takePicture(null, null, callback);

}