Camera shooting. Cannot startPreview() until JPEG data has been prepared internally, so used try/catch phrase.
But even that was not enough, because shutter and jpeg callback should also be synchronized in case of quick succession of touches.
So I made the takePicture() function a critical area, where we can enter only when all resources are available.
Before using TextureView
Added functions to find appropriate picture and preview sizes.
Added preview capture method.