Home » Android » Android Camera API ISO Setting?

Android Camera API ISO Setting?

Posted by: admin May 14, 2020 Leave a comment


Would anyone know where to control the ISO setting for the camera from in the Android SDK ?
It should be possible as the native camera application on the HTC Desire has ISO settings.

How to&Answers:

you should take a look at the methods flatten(), unflatten(), get(String key), set(String key, String value) in android.hardware.Camera.Parameters.
Also consider the source code of that class. It might make things clearer.

First you need to obtain the Camera.Parameters. Unflatten it to a String and investigate it. I am developing on a HTC Desire as well an get the following String:


So basically there is a key called iso-values to retrieve the supported values and a key iso which holds the current value.

You can do the following:

Camera cam = Camera.open();
Camera.Parameters camParams = cam.getParameters();
String supportedIsoValues = camParams.get("iso-values"); //supported values, comma separated String
camParams.set("iso", (String)newValue);

And with reference to the unflattened parameters I would assume that there is a difference between the iso and exposure compensation settings.


By now (KK 4.4.2) android has no official APIs to manage ISO.
ISO management is a totally device dependant matter, and 8/18 devices i tested so far doesn’t support ISO settings at all.
Investigate Camera.getParameters().flatten() String to check valid keywords, every device can use different keywords!!
Most devices use “iso-values” keyword to define a comma separated list-of-possible-values to use with “iso” keyword, like this:

param.set("iso", valid_value_from_list);

Some other devices uses “iso-mode-values” and “iso” keywords (Galaxy Nexus).
I found also a device that uses “iso-speed-values” and “iso-speed” (Micromax A101).
Another one that make me sad is “nv-picture-iso-values” -> “nv-picture-iso” (LG dual P990).

Follow szia answer on how to use these keywords.

Here’s some code i use to get a list of valid values using known keywords:

String flat = param.flatten();
String[] isoValues = null;
String values_keyword=null;
String iso_keyword=null;
if(flat.contains("iso-values")) {
    // most used keywords
} else if(flat.contains("iso-mode-values")) {
    // google galaxy nexus keywords
} else if(flat.contains("iso-speed-values")) {
    // micromax a101 keywords
} else if(flat.contains("nv-picture-iso-values")) {
    // LG dual p990 keywords
// add other eventual keywords here...
if(iso_keyword!=null) {
    // flatten contains the iso key!!
    String iso = flat.substring(flat.indexOf(values_keyword));
    iso = iso.substring(iso.indexOf("=")+1);

    if(iso.contains(";")) iso = iso.substring(0, iso.indexOf(";"));

    isoValues = iso.split(",");

} else {
    // iso not supported in a known way


since I had the same problem of finding if the device has an ISO parameter I looked at this answer https://stackoverflow.com/a/23567103/3976589 and saw that @j.c had solved the problem for 8/18 devices by listing some parameters that he had found on different devices. Based on that listing I found that each paramter contains the words iso and values (sometimes only those words, sometimes something additional).

So if I list all of the camera parameters and search for a strings that contain both words I will know what is the name of the ISO parameter, if it exists. Furthermore if the parameter exists I can take the supported ISO values and if I want to set one of those values i.e. change the camera parameter, I can just remove the -values at the end of the iso-values parameter and then I can change the ISO value successfully.

I will now share my code for this task. First a snippet that retrieves a list with supported ISO values.

    private String ISOValuesParameter = null;
    private String ISOParameter = null;
    private String ISOValues = null;

    private void initCamera() {
        Camera mCamera = Camera.open();

        // this will list supported values
        String ISOvalues = getISOValues(); 
        textViewISO = (TextView) findViewById(R.id.viewISO);

    // setting Minimum ISO value
    if(ISOValuesParameter != null) {
        Camera.Parameters params = mCamera.getParameters();

        ISOParameter = ISOValuesParameter.replace("-values", "");
        params.set(ISOParameter, getMinISO());


        // get the updated ISO value
        params = mCamera.getParameters();

        String ISO = params.get(ISOParameter);

        Toast.makeText(this,"ISO set to: " + ISO, Toast.LENGTH_SHORT).show();


    // returns a list with supported ISO values
    private String getISOValues() {
            ISOValuesParamter = getISOValuesParameter();
            Camera.Parameters params = mCamera.getParameters();
            ISOValues = params.get(ISOValuesParamter);

            return ISOValues!=null ? ISOValues : "ISO not supported";

    // this will return the name of the ISO parameter containing supported ISO values
    private String getISOValuesParameter() {
            Camera.Parameters params = mCamera.getParameters();

            String flatten = params.flatten();
            String[] paramsSeparated = flatten.split(";");
            for(String cur : paramsSeparated) {
                if(cur.contains("iso") && cur.contains("values")) {
                    return cur.substring(0,cur.indexOf('='));

            return null;

This snippet only lists the supported ISO values. In my application I needed to pick the lowest ISO. Here is my solution:

private String getMinISO() {
    if(ISOValues == null) {
        return null;

    String[] ISOarray = ISOValues.split(",");
    Arrays.sort(ISOarray, myComparator);

    String minISO = ISOarray[ISOarray.length-1];

    return minISO;

Here myComparator is a class that compares two strings and sorts the array in descending order. All alphabet words are at the beginning and all numbers are at the end. Here is my implementation:

// Singelton class
public class MyComparator implements  Comparator<String> {

private static MyComparator myComparator = null;

private MyComparator() {}

public int compare(String a, String b) {
    return compareString(a,b);

public static int compareString(String a, String b) {
    if (a.length() > b.length())
        return -1;
    if (a.length() == b.length()) {
        if (a.compareTo(b) > 0)
            return -1;
        else if (a.compareTo(b) == 0)
            return 0;

    return 1;

public static synchronized MyComparator getInstance() {
    if(myComparator==null) {
        myComparator = new MyComparator();

    return myComparator;


I hope my answer helps other people. 🙂



szias answer is correct.


String supportedIsoValues = camParams.get("iso-values"); 

returns null on some devices.

Nevertheless you can set the iso by

Camera cam = Camera.open();
Camera.Parameters camParams = cam.getParameters();
camParams.set("iso", "400"); // values can be "auto", "100", "200", "400", "800", "1600"

I do not know whether “800” or “1600” is supported on all devices

you can check what you did by

String newVAlue = camParams.get("iso");


Forgive my ignorance, but how is this different from “exposure compensation” set via setExposureCompensation()? Wikipedia has some of the conversion formulas you might find useful.