1

使用表面视图从 cameraapi2 读取相机输出后应用程序崩溃。

这是获取图像并提交给另一个控制器的代码。

        Intent resultIntent = new Intent();
        resultIntent.putExtra(ConstKeyVariables.strProfileImage, sImage);
        setResult(Activity.RESULT_OK, resultIntent);
    }

    this.finish();

这是我的 SurfaceView

mPreview = new CameraPreviewNew(this, id, CameraPreviewNew.LayoutMode.FitToParent,camera2id);
    LayoutParams previewLayoutParams = new LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
//mLayout is the container
    mLayout.addView (mPreview, 0, previewLayoutParams);

这是我的毁灭

protected void onDestroy() {
    Log.e("CameraActivity", "Destroying");
    super.onDestroy();
    try {
        stopCameraPreview();
    }catch (Exception ex){
        //ignore
    }
    Log.e("CameraActivity", "Destroyed");
}
4

0 回答 0