当前位置: 首页>>代码示例>>Java>>正文


Java PictureCallback类代码示例

本文整理汇总了Java中android.hardware.Camera.PictureCallback的典型用法代码示例。如果您正苦于以下问题:Java PictureCallback类的具体用法?Java PictureCallback怎么用?Java PictureCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PictureCallback类属于android.hardware.Camera包,在下文中一共展示了PictureCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: takePicture

import android.hardware.Camera.PictureCallback; //导入依赖的package包/类
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);
}
 
开发者ID:OSCAV,项目名称:cvRecognition,代码行数:24,代码来源:Tutorial3View.java

示例2: onClick

import android.hardware.Camera.PictureCallback; //导入依赖的package包/类
@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;
	}
}
 
开发者ID:leleliu008,项目名称:Newton_for_Android_AS,代码行数:25,代码来源:TakePhotoFragment.java

示例3: requestTakePicture

import android.hardware.Camera.PictureCallback; //导入依赖的package包/类
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;
            }
        }
    });
}
 
开发者ID:asm-products,项目名称:nexus-camera,代码行数:19,代码来源:AndroidCameraManagerImpl.java

示例4: take_picture

import android.hardware.Camera.PictureCallback; //导入依赖的package包/类
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);
		}
	});
}
 
开发者ID:diedricm,项目名称:MapEver,代码行数:18,代码来源:CornerDetectionView.java

示例5: onConfigurationChanged

import android.hardware.Camera.PictureCallback; //导入依赖的package包/类
@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);
     }
   }
 
开发者ID:cuplv,项目名称:droidel,代码行数:11,代码来源:Controller.java

示例6: takePhoto

import android.hardware.Camera.PictureCallback; //导入依赖的package包/类
public void takePhoto(PictureCallback jpeg) {
	DebugLog.d(TAG, "takePhoto()");
	
	if (camera != null) {
		camera.takePicture(null, null, jpeg);
	}
}
 
开发者ID:leleliu008,项目名称:Newton_for_Android_AS,代码行数:8,代码来源:CameraManager.java

示例7: takePicture

import android.hardware.Camera.PictureCallback; //导入依赖的package包/类
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();
                    }
                }
            }
    );
}
 
开发者ID:tschaumburg,项目名称:FastBarcodeScanner,代码行数:30,代码来源:StillSequenceCamera.java

示例8: takePicture

import android.hardware.Camera.PictureCallback; //导入依赖的package包/类
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;
    }
}
 
开发者ID:hschott,项目名称:Camdroid,代码行数:14,代码来源:AutoFocusManager.java

示例9: takePicture

import android.hardware.Camera.PictureCallback; //导入依赖的package包/类
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);

}
 
开发者ID:Bootez,项目名称:CameraActivity,代码行数:13,代码来源:CameraActivity.java

示例10: setPictureListener

import android.hardware.Camera.PictureCallback; //导入依赖的package包/类
public void setPictureListener(PictureCallback listener) {
    pictureListener = listener;
}
 
开发者ID:jorenham,项目名称:fingerblox,代码行数:4,代码来源:CameraView.java

示例11: takePicture

import android.hardware.Camera.PictureCallback; //导入依赖的package包/类
@Override
public void takePicture(PictureCallback callback,
		TakePictureListener listener) {
	mCameraView.takePicture(callback,listener);
}
 
开发者ID:Alex-Jerry,项目名称:LLApp,代码行数:6,代码来源:CameraContainer.java

示例12: takePicture

import android.hardware.Camera.PictureCallback; //导入依赖的package包/类
@Override
public void takePicture(PictureCallback callback,CameraContainer.TakePictureListener listener){
	mCamera.takePicture(null, null, callback);
}
 
开发者ID:Alex-Jerry,项目名称:LLApp,代码行数:5,代码来源:CameraView.java

示例13: takePicture

import android.hardware.Camera.PictureCallback; //导入依赖的package包/类
public void takePicture(PictureCallback callback) {
    if (this.mAutoFocusManager != null) {
        this.mAutoFocusManager.takePicture(callback);
    }
}
 
开发者ID:hschott,项目名称:Camdroid,代码行数:6,代码来源:CameraPreviewView.java

示例14: setPictureCallback

import android.hardware.Camera.PictureCallback; //导入依赖的package包/类
public void setPictureCallback(PictureCallback pictureCallback) {
	this.pictureCallback = pictureCallback;
}
 
开发者ID:phoenixNirvana,项目名称:NewCommunication-Android,代码行数:4,代码来源:CameraManager.java

示例15: takePicture

import android.hardware.Camera.PictureCallback; //导入依赖的package包/类
public void takePicture(final PictureCallback jpegCallback) {
    if (null == camera) return;
    camera.takePicture(null, null, jpegCallback);
}
 
开发者ID:gerc99,项目名称:SawimNE,代码行数:5,代码来源:Preview.java


注:本文中的android.hardware.Camera.PictureCallback类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。