Android Utililty Methods Camera Check

List of utility methods to do Camera Check


The list of methods to do Camera Check are organized into topic(s).


booleansizeSupported(Camera.Parameters cp, CamcorderProfile profile)
size Supported
List<Camera.Size> sl = cp.getSupportedVideoSizes();
if (sl == null)
    sl = cp.getSupportedPictureSizes();
for (Camera.Size s : sl) {
    if (profile.videoFrameWidth == s.width
            && profile.videoFrameHeight == s.height)
        return true;
return false;
booleanhasFlash(Camera mCamera)
Check if this device has flash
if (mCamera == null) {
    return false;
Camera.Parameters parameters = mCamera.getParameters();
if (parameters.getFlashMode() == null) {
    return false;
List<String> supportedFlashModes = parameters
PointfindBestPreviewSizeValue( Camera.Parameters parameters, Point screenResolution)
find Best Preview Size Value
List<Camera.Size> rawSupportedSizes = parameters
if (rawSupportedSizes == null) {
            "Device returned no supported preview sizes; using default");
    Camera.Size defaultSize = parameters.getPreviewSize();
    if (defaultSize == null) {
        throw new IllegalStateException(