Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8000551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:50:01+00:00 2026-06-04T15:50:01+00:00

I am automatically focusing each 3 seconds, and my code works on my hardware

  • 0

I am automatically focusing each 3 seconds, and my code works on my hardware device (Galaxy S), but on my AVD (virtual device) the callback, which should be called after the focus has finished, never gets called.
Someone knows why?

public void onPreviewStart(){
        Log.v(TAG,"onPreviewStart() focusTimer: "+focusTimer);
        if(this.autoFocus == true && getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_AUTOFOCUS)){
            focusTimer = new Runnable() {
                public void run() {
                    Log.d(TAG, "focus run..");
                    if(preview != null && preview.camera != null && !saving){
                        focusing = true;

                        Log.d(TAG, "focusing.."+preview);
                        //  ----> this gets called each 3 seconds
                        preview.camera.autoFocus(new Camera.AutoFocusCallback() {   

                            public void onAutoFocus(boolean success, Camera camera) {
                                // ----> this never gets called on ICS :(
                                Log.d(TAG, "onAutoFocus()");
                                focusing = false;
                                if(shootButtonWasPressed){  // if shooting was scheduled
                                    Log.d(TAG, "shootButtonWasPressed");
                                    shoot();
                                    shootButtonWasPressed = false;
                                }
                            }
                        });
                    }
                    preview.postDelayed(focusTimer, 3000);
                }
            };
            Log.v(TAG,"focusTimer run()");
            focusTimer.run();
        }else{
            focusTimer = null;
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:50:02+00:00Added an answer on June 4, 2026 at 3:50 pm

    You’re code seems to be right. The problem is, on your AVD, you’re camera is your webcam or something like this. This webcam’s have a static focus, so you’re code can’t work on it…

    If you want to test this, try to upgrade your cellphone to 4.0, if you need help with you’re galaxy s take a look here: http://forum.xda-developers.com/forumdisplay.php?f=656

    I hope you’ll see the problem now!

    Best Regards

    safari

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I automatically run some code when a WPF form is closed?
Jinja2 automatically escapes all HTML tags, but I want to not escape some tags
My id's are automatically assigned in the html-document and therefore unique, but if a
i have the following code which extends the JQuery and adds a method to
I'm using wget to automatically download the ShellEd extension for Eclipse, but am receiving
I am developing an app which takes a preview of the device's camera and
SQLyog automatically appending LIMIT 0, 1000 to all queries in a database which is
Vim automatically expands .gz files when I open them up, which is great. However,
Is it possible to automatically remove code comments in Visual Studio files before committing
How can I automatically check errors in my code when I'm using Sublime Text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.