# Bug on KetaiCamera solved, please recompile lib!

**URL:** <https://discourse.processing.org/t/bug-on-ketaicamera-solved-please-recompile-lib/40025>\
**Category:** Processing for Android\
**Created:** [December 5, 2022, 9:13am UTC](https://discourse.processing.org/t/bug-on-ketaicamera-solved-please-recompile-lib/40025 "2022-12-05T09:13:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![erkosone](https://avatars.discourse-cdn.com/v4/letter/e/ba9def/32.png) [@erkosone](https://discourse.processing.org/u/erkosone)\
**Post date:** [December 5, 2022, 9:13am UTC](https://discourse.processing.org/t/bug-on-ketaicamera-solved-please-recompile-lib/40025/1 "2022-12-05T09:13:58Z")

</div>

Hello, I just fixed a bug in the Ketai library, in its module for the android “camera”.  
This library contains obsolete code for autofocus and it needs to be corrected, I would appreciate it if someone would recompile the library with the necessary correction and share it, I have corrected it for my project and I am using the source code from the sketch but I would like to share the progress .

```auto
/**
     * Auto settings - set camera to use auto adjusting settings
     */
    public void autoSettings() {
        if (camera == null)
            return;

        // PApplet.println("KetaiCamera: setting camera settings to auto...");
        Parameters cameraParameters = camera.getParameters();
        if (cameraParameters.isAutoExposureLockSupported())
            cameraParameters.setAutoExposureLock(false);
        if (cameraParameters.isAutoWhiteBalanceLockSupported())
            cameraParameters.setAutoWhiteBalanceLock(false);

        List<String> fModes = cameraParameters.getSupportedFocusModes();
        for (String s : fModes) {
            PApplet.println("FocusMode: " + s);
            /*
            if (s.equalsIgnoreCase(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE))
                cameraParameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
            */
            
            // this is the repaired bug for auto focus!!
            if (s.equalsIgnoreCase("FocusMode: auto")){
                cameraParameters.setFocusMode(Parameters.FOCUS_MODE_AUTO);
            }

        }

        camera.setParameters(cameraParameters);
        camera.autoFocus(autofocusCB);
        // PApplet.println("KetaiCamera autoSettings: "
        // + camera.getParameters().flatten());
    }

```

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [December 6, 2022, 8:27am UTC](https://discourse.processing.org/t/bug-on-ketaicamera-solved-please-recompile-lib/40025/2 "2022-12-06T08:27:02Z")

</div>

Hi,

[Ketai](http://ketai.org/) is open-source and the code is hosted [on GitHub](https://github.com/ketai/ketai).

You can [open a pull request](https://docs.github.com/en/get-started/quickstart/contributing-to-projects) and propose a change to fix your issue 😉 :

[https://github.com/ketai/ketai/pulls](https://github.com/ketai/ketai/pulls)
