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 7412727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:35:12+00:00 2026-05-29T06:35:12+00:00

I have a customer with an LG Optimus Black (android 2.2.2) that have the

  • 0

I have a customer with an LG Optimus Black (android 2.2.2) that have the camera preview every time black. On other devices all is working fine. Is there some issue on this phone or someone have a solution? The code for my camera preview is the follow.

    SurfaceHolder.Callback mySurfaceHolderCallback = new SurfaceHolder.Callback()
{
    @Override
    public void surfaceCreated(SurfaceHolder holder)
    {
        Log.i("GMG", "surfaceCreated");

        try
        {
            mCamera = Camera.open();
            holder.setFormat(PixelFormat.TRANSLUCENT);
            mCamera.setPreviewDisplay(holder);
        }
        catch (IOException e)
        {
            if (mCamera == null) return;
            mPreviewRunning= false;
            mCamera.release();
            mCamera = null;             
        }
    }

    @Override
    public void surfaceDestroyed(SurfaceHolder holder)
    {
        Log.i("GMG", "surfaceDestroyed");
        if (mCamera != null)
        {
            mCamera.stopPreview();
            mPreviewRunning= false;
            mCamera.release();
            mCamera = null;
        }
    }

    @Override
    public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
    {
        Log.i("GMG", "surfaceChanged");

        if (mCamera != null)
        {
            if(mPreviewRunning) mCamera.stopPreview();

            Camera.Parameters p = mCamera.getParameters();

            //Angolo visivo della fotocamera
            angoloVisualeX = p.getHorizontalViewAngle();
            angoloVisualeY = p.getVerticalViewAngle();

            //Formati della preview
            supportedPreviewSize = p.getSupportedPreviewSizes();            
            int preview_width = supportedPreviewSize.get(supportedPreviewSize.size()-1).width;
            int preview_height = supportedPreviewSize.get(supportedPreviewSize.size()-1).height;
            p.setPreviewSize(preview_width, preview_height);

            //Set camera orientation
            Display display = ((WindowManager)getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
            if(display.getRotation() == Surface.ROTATION_0) mCamera.setDisplayOrientation(90);
            if(display.getRotation() == Surface.ROTATION_270) mCamera.setDisplayOrientation(180);

            mCamera.setParameters(p);
            mCamera.startPreview();
            mPreviewRunning = true;
        }
    }
};

Best regards.

  • 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-05-29T06:35:13+00:00Added an answer on May 29, 2026 at 6:35 am

    I have solved, I don’t know why, but witha big camera preview I dont have the problem

    change

            int preview_width = supportedPreviewSize.get(supportedPreviewSize.size()-1).width;
            int preview_height = supportedPreviewSize.get(supportedPreviewSize.size()-1).height;
    

    with

            int preview_width = supportedPreviewSize.get(0).width;
            int preview_height = supportedPreviewSize.get(0).height;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a customer that been on the web for some time. They have
I have a Customer class that contains a property, MyProperty, which is of a
We have a customer that would like to modify application user messages that we
I often have customer requesting changing properties, like the version history setting on all
I have customer that uses older, custom built ERP application for which they don't
I have Customer class that make connection to db and save data to mysql.
I have customer database that we use for auto-charges. It would appear that the
Overview : I created a system that have Customer area and Admin area. Both
I have a customer table that I want to use to populate a parameter
I have a customer that wants to see midnight represented as the end of

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.