catch and show exceptions thrown at starting recording

This commit is contained in:
tibbi 2018-06-18 21:22:19 +02:00
parent 7afa969505
commit 335529ccbb
1 changed files with 7 additions and 1 deletions

View File

@ -33,6 +33,7 @@ import com.simplemobiletools.camera.helpers.*
import com.simplemobiletools.camera.interfaces.MyPreview import com.simplemobiletools.camera.interfaces.MyPreview
import com.simplemobiletools.camera.models.FocusArea import com.simplemobiletools.camera.models.FocusArea
import com.simplemobiletools.camera.models.MySize import com.simplemobiletools.camera.models.MySize
import com.simplemobiletools.commons.extensions.showErrorToast
import com.simplemobiletools.commons.helpers.isJellyBean1Plus import com.simplemobiletools.commons.helpers.isJellyBean1Plus
import java.io.File import java.io.File
import java.lang.IllegalArgumentException import java.lang.IllegalArgumentException
@ -851,7 +852,12 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
} }
} }
try {
mCameraDevice!!.createCaptureSession(surfaces, captureCallback, mBackgroundHandler) mCameraDevice!!.createCaptureSession(surfaces, captureCallback, mBackgroundHandler)
} catch (e: Exception) {
mActivity.showErrorToast(e)
mCameraState = STATE_PREVIEW
}
} }
private fun stopRecording() { private fun stopRecording() {