I have a problem with Camera and Android Version.
I try to get preview size supported by Android Camera flow as below :
@Override
public void surfaceCreated(SurfaceHolder holder) {
// TODO Auto-generated method stub
mCamera = Camera.open();
mSupportedPreviewSizes = mCamera.getParameters()
.getSupportedPreviewSizes();
try {
mCamera.setPreviewDisplay(holder);
} catch (IOException exception) {
mCamera.release();
mCamera = null;
}
}
I try to test my code on 2 Android Version with Emulator ( Android 2.2 SDK && Android 2.1 SDK )
Configuration for both of version Android in Emulator as below:
Skin : HVGA
Abstracted LCD density : 160
My problem :
When I run my Apps on Emulator – 2.2 SDK : OK — GOOD
but when I run on Emulator – 2.1 SDK : have a problem ” mCamera.getParameters().getSupportedPreviewSizes() return is NULL “
If you known that, please help me !
Thank you very very very ……….much….
This is listed as a defect by Google, which I assume means there are plans to fix it:
http://code.google.com/p/android/issues/detail?id=6271
I’ve experienced this on some hardware devices running android all the way up to 4.0. So far, the only thing I’ve been able to do is handle the case where getSupportedPreviewSizes() returns null. It doesn’t always happen for me, so I’ll normally destroy and re-instantiate my preview surface and camera if I detect this has happened.