1

App crash after reading camera output from cameraapi2 with surface view.

This is the code to get the image and submit to another controller.

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

    this.finish();

This is my 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);

This is my ondestroy

protected void onDestroy() {
    Log.e("CameraActivity", "Destroying");
    super.onDestroy();
    try {
        stopCameraPreview();
    }catch (Exception ex){
        //ignore
    }
    Log.e("CameraActivity", "Destroyed");
}
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
topspindex
  • 41
  • 5

0 Answers0