本文整理了Java中android.hardware.Camera.setOneShotPreviewCallback()
方法的一些代码示例,展示了Camera.setOneShotPreviewCallback()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Camera.setOneShotPreviewCallback()
方法的具体详情如下:
包路径:android.hardware.Camera
类名称:Camera
方法名:setOneShotPreviewCallback
暂无
代码示例来源:origin: journeyapps/zxing-android-embedded
/**
* A single preview frame will be returned to the supplied callback.
*
* The thread on which this called is undefined, so a Handler should be used to post the result
* to the correct thread.
*
* @param callback The callback to receive the preview.
*/
public void requestPreviewFrame(PreviewCallback callback) {
Camera theCamera = camera;
if (theCamera != null && previewing) {
cameraPreviewCallback.setCallback(callback);
theCamera.setOneShotPreviewCallback(cameraPreviewCallback);
}
}
代码示例来源:origin: JZ-Darkal/AndroidHttpCapture
/**
* A single preview frame will be returned to the handler supplied. The data will arrive as byte[]
* in the message.obj field, with width and height encoded as message.arg1 and message.arg2,
* respectively.
*
* @param handler The handler to send the message to.
* @param message The what field of the message to be sent.
*/
public synchronized void requestPreviewFrame(Handler handler, int message) {
Camera theCamera = camera;
if (theCamera != null && previewing) {
previewCallback.setHandler(handler, message);
theCamera.setOneShotPreviewCallback(previewCallback);
}
}
代码示例来源:origin: rmtheis/android-ocr
/**
* A single preview frame will be returned to the handler supplied. The data will arrive as byte[]
* in the message.obj field, with width and height encoded as message.arg1 and message.arg2,
* respectively.
*
* @param handler The handler to send the message to.
* @param message The what field of the message to be sent.
*/
public synchronized void requestOcrDecode(Handler handler, int message) {
Camera theCamera = camera;
if (theCamera != null && previewing) {
previewCallback.setHandler(handler, message);
theCamera.setOneShotPreviewCallback(previewCallback);
}
}
代码示例来源:origin: dm77/barcodescanner
public void stopCameraPreview() {
if(mCameraWrapper != null) {
try {
mPreviewing = false;
getHolder().removeCallback(this);
mCameraWrapper.mCamera.cancelAutoFocus();
mCameraWrapper.mCamera.setOneShotPreviewCallback(null);
mCameraWrapper.mCamera.stopPreview();
} catch(Exception e) {
Log.e(TAG, e.toString(), e);
}
}
}
代码示例来源:origin: TommyLemon/APIJSON
/**
* A single preview frame will be returned to the handler supplied. The data will arrive as byte[]
* in the message.obj field, with width and height encoded as message.arg1 and message.arg2,
* respectively.
*
* @param handler The handler to send the message to.
* @param message The what field of the message to be sent.
*/
public void requestPreviewFrame(Handler handler, int message) {
if (camera != null && previewing) {
previewCallback.setHandler(handler, message);
if (useOneShotPreviewCallback) {
camera.setOneShotPreviewCallback(previewCallback);
} else {
camera.setPreviewCallback(previewCallback);
}
}
}
代码示例来源:origin: yipianfengye/android-zxingLibrary
/**
* A single preview frame will be returned to the handler supplied. The data will arrive as byte[]
* in the message.obj field, with width and height encoded as message.arg1 and message.arg2,
* respectively.
*
* @param handler The handler to send the message to.
* @param message The what field of the message to be sent.
*/
public void requestPreviewFrame(Handler handler, int message) {
if (camera != null && previewing) {
previewCallback.setHandler(handler, message);
if (useOneShotPreviewCallback) {
camera.setOneShotPreviewCallback(previewCallback);
} else {
camera.setPreviewCallback(previewCallback);
}
}
}
代码示例来源:origin: TommyLemon/Android-ZBLibrary
/**
* A single preview frame will be returned to the handler supplied. The data will arrive as byte[]
* in the message.obj field, with width and height encoded as message.arg1 and message.arg2,
* respectively.
*
* @param handler The handler to send the message to.
* @param message The what field of the message to be sent.
*/
public void requestPreviewFrame(Handler handler, int message) {
if (camera != null && previewing) {
previewCallback.setHandler(handler, message);
if (useOneShotPreviewCallback) {
camera.setOneShotPreviewCallback(previewCallback);
} else {
camera.setPreviewCallback(previewCallback);
}
}
}
代码示例来源:origin: dm77/barcodescanner
public void showCameraPreview() {
if(mCameraWrapper != null) {
try {
getHolder().addCallback(this);
mPreviewing = true;
setupCameraParameters();
mCameraWrapper.mCamera.setPreviewDisplay(getHolder());
mCameraWrapper.mCamera.setDisplayOrientation(getDisplayOrientation());
mCameraWrapper.mCamera.setOneShotPreviewCallback(mPreviewCallback);
mCameraWrapper.mCamera.startPreview();
if(mAutoFocus) {
if (mSurfaceCreated) { // check if surface created before using autofocus
safeAutoFocus();
} else {
scheduleAutoFocus(); // wait 1 sec and then do check again
}
}
} catch (Exception e) {
Log.e(TAG, e.toString(), e);
}
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testSetOneShotPreviewCallbacks() throws Exception {
TestPreviewCallback callback = new TestPreviewCallback();
assertThat(callback.camera).isNull();
assertThat(callback.data).isNull();
camera.setOneShotPreviewCallback(callback);
shadowCamera.invokePreviewCallback("foobar".getBytes(UTF_8));
assertThat(callback.camera).isSameAs(camera);
assertThat(callback.data).isEqualTo("foobar".getBytes(UTF_8));
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testClearPreviewCallback() throws Exception {
TestPreviewCallback callback = new TestPreviewCallback();
assertThat(callback.camera).isNull();
assertThat(callback.data).isNull();
camera.setPreviewCallback(callback);
camera.setPreviewCallback(null);
shadowCamera.invokePreviewCallback("foobar".getBytes(UTF_8));
assertThat(callback.camera).isNull();
assertThat(callback.data).isNull();
camera.setOneShotPreviewCallback(callback);
camera.setOneShotPreviewCallback(null);
shadowCamera.invokePreviewCallback("foobar".getBytes(UTF_8));
assertThat(callback.camera).isNull();
assertThat(callback.data).isNull();
camera.setPreviewCallbackWithBuffer(callback);
camera.setPreviewCallbackWithBuffer(null);
shadowCamera.invokePreviewCallback("foobar".getBytes(UTF_8));
assertThat(callback.camera).isNull();
assertThat(callback.data).isNull();
}
代码示例来源:origin: Coinomi/coinomi-android
public void requestPreviewFrame(final PreviewCallback callback)
{
camera.setOneShotPreviewCallback(callback);
}
代码示例来源:origin: openwalletGH/openwallet-android
public void requestPreviewFrame(final PreviewCallback callback)
{
camera.setOneShotPreviewCallback(callback);
}
代码示例来源:origin: JustinRoom/JSCKit
@Override
public void run() {
if (mCamera != null && mSpotAble) {
try {
mCamera.setOneShotPreviewCallback(QRCodeView.this);
} catch (Exception e) {
e.printStackTrace();
}
}
}
};
代码示例来源:origin: shuijilove/ZXingCodeDemo
@Override
public void run() {
if (mCamera != null && mSpotAble) {
try {
mCamera.setOneShotPreviewCallback(QRCodeView.this);
} catch (Exception e) {
e.printStackTrace();
}
}
}
};
代码示例来源:origin: huangweicai/OkLibDemo
@Override
public void run() {
if (mCamera != null && mSpotAble) {
try {
mCamera.setOneShotPreviewCallback(QRCodeView.this);
} catch (Exception e) {
e.printStackTrace();
}
}
}
};
代码示例来源:origin: simplezhli/Tesseract-OCR-Scanner
/**
* A single preview frame will be returned to the handler supplied. The data will arrive as byte[] in the
* message.obj field, with width and height encoded as message.arg1 and message.arg2, respectively.
*
* @param handler The handler to send the message to.
* @param message The what field of the message to be sent.
*/
public void requestPreviewFrame(Handler handler, int message) {
if (mCamera != null && mPreviewing) {
mPreviewCallback.setHandler(handler, message);
mCamera.setOneShotPreviewCallback(mPreviewCallback);
}
}
代码示例来源:origin: iluhcm/QrCodeScanner
/**
* A single preview frame will be returned to the handler supplied. The data will arrive as byte[] in the
* message.obj field, with width and height encoded as message.arg1 and message.arg2, respectively.
*
* @param handler The handler to send the message to.
* @param message The what field of the message to be sent.
*/
public void requestPreviewFrame(Handler handler, int message) {
if (mCamera != null && mPreviewing) {
mPreviewCallback.setHandler(handler, message);
mCamera.setOneShotPreviewCallback(mPreviewCallback);
}
}
代码示例来源:origin: Affectiva/android-sdk-samples
synchronized public void setOneShotPreviewCallback(Camera.PreviewCallback callback) {
checkTaken();
camera.setOneShotPreviewCallback(callback);
}
代码示例来源:origin: huangweicai/OkLibDemo
public void stopCameraPreview() {
if (mCamera != null) {
try {
removeCallbacks(doAutoFocus);
mPreviewing = false;
mCamera.cancelAutoFocus();
mCamera.setOneShotPreviewCallback(null);
mCamera.stopPreview();
} catch (Exception e) {
Log.e(TAG, e.toString(), e);
}
}
}
代码示例来源:origin: JustinRoom/JSCKit
public void stopCameraPreview() {
if (mCamera != null) {
try {
removeCallbacks(doAutoFocus);
mPreviewing = false;
mCamera.cancelAutoFocus();
mCamera.setOneShotPreviewCallback(null);
mCamera.stopPreview();
} catch (Exception e) {
Log.e(TAG, e.toString(), e);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!