I Creating custom camera app i am using Surfaceview. In my app i capture the picture but it work perfectly in Note 4 and it problematic in xiaomi mobile and i don\'t the r
I am post question for about 3 hours but no one even commenting.
I figure out whats the problem. It is depending on parameter part Reference
Here is my code
private void initPreview(int width, int height) {
if (camera != null && previewHolder.getSurface() != null) {
try {
camera.setPreviewDisplay(previewHolder);
} catch (Throwable t) {
// Log.e("PreviewDemo-surfaceCallback","Exception in setPreviewDisplay()");
}
Camera.Parameters parameters = camera.getParameters();
Camera.Size size = getBestPreviewSize(width, height, parameters);
parameters.setJpegQuality(90);
if (size != null) {
Log.d("", "initPreview: width = "+size.width+ " height = "+size.height);
parameters.setPreviewSize(size.width, size.height);
parameters.setPictureSize(size.width, size.height);
camera.setParameters(parameters);
cameraConfigured = true;
}
}
}