w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Android: Camera with SurfaceView

See my comment about the emulator. But the reason your app crashes is because you catch the exception of the camera failing to open and return null. Then in your CameraPreview class you save this null value to 'mCamera' and then later dereference it in surfaceCreated:

mCamera.setPreviewDisplay(holder);

So your original question is why is it crashing...it's crashing because you are not handling error conditions well.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.