set Camera Picture Size - Android Camera

Android examples for Camera:Camera Size

Description

set Camera Picture Size

Demo Code


//package com.java2s;

import java.util.List;

import android.hardware.Camera.Parameters;

import android.hardware.Camera.Size;

public class Main {
    public static boolean setCameraPictureSize(String candidate,
            List<Size> supported, Parameters parameters) {
        int index = candidate.indexOf('x');
        if (index == -1)
            return false;
        int width = Integer.parseInt(candidate.substring(0, index));
        int height = Integer.parseInt(candidate.substring(index + 1));
        for (Size size : supported) {
            if (size.width == width && size.height == height) {
                parameters.setPictureSize(width, height);
                return true;
            }//from w ww .j  a  v  a 2 s.  c  o  m
        }
        return false;
    }
}

Related Tutorials