本文整理汇总了Java中android.hardware.Camera.PictureCallback方法的典型用法代码示例。如果您正苦于以下问题:Java Camera.PictureCallback方法的具体用法?Java Camera.PictureCallback怎么用?Java Camera.PictureCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.hardware.Camera
的用法示例。
在下文中一共展示了Camera.PictureCallback方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: takePhoto
import android.hardware.Camera; //导入方法依赖的package包/类
public void takePhoto(){
Camera.ShutterCallback shutterCallback = new Camera.ShutterCallback() {
public void onShutter() {
Log.d(TAG, "onShutter: ");
}
};
Camera.PictureCallback jpegCallback = new Camera.PictureCallback() {
public void onPictureTaken(final byte[] data, final Camera camera) {
camera.startPreview();
Log.d(TAG, "onPictureTaken: ");
pictureTakenCallBack.saveAsBitmap(data);
}
};
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
camera.enableShutterSound(false);
}
camera.takePicture(shutterCallback, null, jpegCallback);
}
示例2: takePicture
import android.hardware.Camera; //导入方法依赖的package包/类
public void takePicture( Camera.PictureCallback jpeg){
try{
camera.takePicture(null, null, jpeg);
}catch (RuntimeException e){
Toast.makeText(context, "请等待", Toast.LENGTH_LONG).show();
}
}
示例3: savePicture
import android.hardware.Camera; //导入方法依赖的package包/类
private boolean savePicture(){
Camera.PictureCallback picture=cameraInitializer.getPicture();
if(picture!=null){
cameraInitializer.getCamera().takePicture(null, null, cameraInitializer.getPicture());
return true;
}
else{
return false;
}
}
示例4: takePictureWithAutoFocus
import android.hardware.Camera; //导入方法依赖的package包/类
private void takePictureWithAutoFocus(final android.hardware.Camera mCamera, final Camera.PictureCallback mCall) {
final Handler uiThreadHandler = new Handler();
if (mCamera.getParameters().getFocusMode().equals(Camera.Parameters.FOCUS_MODE_AUTO)) {
mCamera.autoFocus(new Camera.AutoFocusCallback() {
@Override
public void onAutoFocus(boolean success, Camera camera) {
uiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
mCamera.takePicture(new Camera.ShutterCallback() {
@Override
public void onShutter() {
mCamera.cancelAutoFocus();
}
}, null, mCall);
}
}, 500);
}
});
} else {
uiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
mCamera.takePicture(null, null, mCall);
}
}, 500);
}
}
示例5: run_camera
import android.hardware.Camera; //导入方法依赖的package包/类
public void run_camera(Context context, Camera.PictureCallback callback) {
if (!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
Log.d("ERROR", "NO CAMERA");
} else {
safeCameraOpen(defaultCameraId);
}
SmartCamera.setCameraDisplayOrientation((Activity) context, defaultCameraId, camera);
SurfaceTexture surfaceTexture = new SurfaceTexture(0);
try {
camera.setPreviewTexture(surfaceTexture);
Camera.Parameters params = camera.getParameters();
params.setJpegQuality(100);
//params.set
camera.setParameters(params);
camera.startPreview();
camera.takePicture(null, null, callback);
} catch (
Exception ex)
{
Log.d("ERROR", ex.toString());
}
}
示例6: rawCallbackOrNull
import android.hardware.Camera; //导入方法依赖的package包/类
private Camera.PictureCallback rawCallbackOrNull(final EasyCamera.PictureCallback callback) {
if (callback != null) {
return new Camera.PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
callback.onPictureTaken(data, DefaultCameraActions.this); //TODO is this the right CameraActions?
}
};
}
return null;
}
示例7: getPicture
import android.hardware.Camera; //导入方法依赖的package包/类
public Camera.PictureCallback getPicture() {
return Picture;
}
示例8: takePicture
import android.hardware.Camera; //导入方法依赖的package包/类
public static void takePicture(Camera.ShutterCallback shutterCallback, Camera.PictureCallback rawCallback,
Camera.PictureCallback jpegCallback){
mCamera.takePicture(shutterCallback, rawCallback, jpegCallback);
}
示例9: takePicture
import android.hardware.Camera; //导入方法依赖的package包/类
public void takePicture(Camera.ShutterCallback shutter, Camera.PictureCallback raw,
Camera.PictureCallback jpeg) {
if (mCamera != null) {
mCamera.takePicture(shutter, raw, jpeg);
}
}
示例10: takeShot
import android.hardware.Camera; //导入方法依赖的package包/类
public void takeShot(Camera.ShutterCallback shutterCallback,
Camera.PictureCallback rawPictureCallback,
Camera.PictureCallback jpegPictureCallback ){
mCamera.takePicture(shutterCallback, rawPictureCallback, jpegPictureCallback);
}