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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:41:22+00:00 2026-06-17T15:41:22+00:00

Well, I updated my question again, totally this time. I have tested the following

  • 0

Well, I updated my question again, totally this time.

I have tested the following code on Galaxy Nexus(JB), Moto-XX(GB), SAMSUNG(Froyo) one by one, with different problems/exceptions occurred.

public class MainActivity extends Activity {
    @SuppressLint("NewApi")
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

          ShutterCallback shutterCallback = new ShutterCallback() {
           public void onShutter() {
                  System.out.println("shutterCallback");
           }
          };

          PictureCallback rawCallback = new PictureCallback() {
           public void onPictureTaken(byte[] data, Camera camera) {
                  System.out.println("onPictureTaken");
           }
          };

          PictureCallback jpegCallback = new PictureCallback() {
           public void onPictureTaken(byte[] data, Camera camera) {
                  System.out.println("jpegCallback");
                  FileOutputStream outStream = null;
                  try {
                  System.out.println("jpegCallback begin");
                     camera.startPreview();
                     File storagePath =  new File("/mnt/sdcard/");
                     File myImage = new File(storagePath, "example2.jpg");
                     outStream = new FileOutputStream(myImage); 
                     outStream.write(data);
                     outStream.close();
                    } catch (FileNotFoundException e) {
                          System.out.println("jpegCallback FileNotFoundException");
                     e.printStackTrace();
                    } catch (IOException e) {
                          System.out.println("jpegCallback IOException");
                     e.printStackTrace();
                    } finally {
                     camera.stopPreview();
                     camera.release();
                    }
            }
          };

          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
              for (int i = 0; i < Camera.getNumberOfCameras(); i++) {
              Camera.CameraInfo info = new Camera.CameraInfo();
              Camera.getCameraInfo(i, info);
              if (info.facing == Camera.CameraInfo.CAMERA_FACING_BACK) {
                     try{
                             Camera camera = Camera.open(i);
                             Camera.Parameters parameters = camera.getParameters();
                             camera.setParameters(parameters);
                              camera.startPreview();
                             camera.setPreviewDisplay(null);
                              System.out.println("takePicture ahead");
                             camera.takePicture(null, rawCallback, jpegCallback);
                              System.out.println("takePicture finish");
                            }
                            catch (Exception e){
                                  System.out.println("printStackTrace");
                                     e.printStackTrace();
                            }
                    }
                }
            }  
    }

The detailed problems are:


In Android4.1&4.2, there are three parts of exceptions:
1.caused by “Camera camera = Camera.open(i);”

11-26 00:36:29.144: D/DOMX(132): ERROR: failed check:status >= 0 - returning error: 0x81000 - Can't connect
11-26 00:36:29.144: D/DOMX(132): ERROR: failed check:eRPCError == RPC_OMX_ErrorNone - returning error: 0x80001001 - Error initializing RPC
11-26 00:36:29.144: D/DOMX(132): ERROR: failed check:hRPCCtx != NULL - returning error: 0x81001 - NULL context handle supplied to RPC Deinit
11-26 00:36:29.144: D/DOMX(132): ERROR: rror in Initializing Proxy
11-26 00:36:29.144: E/CameraHAL(132): OMX_GetHandle() failed, error: 0x80001001

2.caused by “camera.startPreview();”

11-26 00:36:30.488: D/DOMX(132): ERROR: failed check:(eError == OMX_ErrorNone) || (eError == OMX_ErrorNoMore) - returning error: 0x80001005 - Error returned from OMX API in ducati
11-26 00:36:30.488: E/CameraHAL(132): Error while configuring rotation 0x80001005

3.caused by “camera.takePicture()”

11-26 00:36:30.495: E/CameraHAL(132): Adapter state switch INTIALIZED_STATE Invalid Op! event = 0x13
11-26 00:36:30.738: D/DOMX(132): ERROR: failed check:(eError == OMX_ErrorNone) || (eError == OMX_ErrorNoMore) - returning error: 0x80001005 - Error returned from OMX API in ducati
11-26 00:36:30.738: E/CameraHAL(132): Exiting function UseBuffersCapture because of ret 0 eError=80001005

So, the result is that picture is not taken in Jelly Bean, even in common device like Galaxy Nexus i9250.


Next, in Android2.3, there are two parts of exceptions:
1.caused by “Camera camera = Camera.open(i);”

E/CameraSettings(1235): Param type 53 not supported        
E/CameraSettings(1235): Param type 51 not supported        
E/CameraSettings(1235): Param type 50 not supported  

2.Even though, the camera.takePicture() can still be executed. And the result shows picture is taken. Except for one problem: “E/MemoryHeapBase(1235): mmap(fd=50, size=0) failed (Invalid argument)”

11-26 01:28:33.835: I/AwesomePlayer(1235): prepareAsync_l
11-26 01:28:33.835: D/CameraHal(1235): Capture size 2048x1536, res enum 3
11-26 01:28:33.835: I/AwesomePlayer(1235): prepareAsync_l
11-26 01:28:33.835: D/CameraHal(1235): Setting capture format 0 header 2
11-26 01:28:33.835: I/HPAndroidHAL(1235): APILOG: SetCaptureDataFormat (1 2 0)
11-26 01:28:33.835: D/CameraHal(1235): Thumbnail enabled
11-26 01:28:33.843: E/MemoryHeapBase(1235): mmap(fd=50, size=0) failed (Invalid argument)
11-26 01:28:33.843: D/CameraHal(1235): Initializing capture memory raw: 0x42ee6000 (6295552), jpg: 0x434e7000 (3147776), pv 0xffffffff (0)
11-26 01:28:33.843: I/HPAndroidHAL(1235): APILOG: InitializeCaptureMemory(3 3147776 0x434e7000 6295552 0x42ee6000 0 0xffffffff)
11-26 01:28:33.843: I/HPAndroidHAL(1235): APILOG: InitializeCaptureMemoryBuffers(3 1 0_0x42de5d9c 6295552_0x42de5dc0 3147776_0x42de5d94 0_0x42de5dc8)
11-26 01:28:33.843: I/HPAndroidHAL(1235): APILOG: SetCaptureS2 with finish3A = 1
11-26 01:28:33.843: I/VorbisDecoder(1235): mNumChannels=1, mSampleRate=44100
11-26 01:28:33.843: E/OMXCodec(1235): Successfully allocated software codec 'VorbisDecoder'
11-26 01:28:33.843: I/VorbisDecoder(1235): mNumChannels=1, mSampleRate=44100
11-26 01:28:33.843: E/OMXCodec(1235): Successfully allocated software codec 'VorbisDecoder'
11-26 01:28:33.851: I/AwesomePlayer(1235): play_l
11-26 01:28:33.851: I/AwesomePlayer(1235): play_l
11-26 01:28:33.874: I/AwesomePlayer(1235): pause_l 1
11-26 01:28:33.874: I/AwesomePlayer(1235): reset_l
11-26 01:28:33.874: I/ExtendFileSource(1235): release pFilename = 0xfb690
11-26 01:28:33.874: I/AwesomePlayer(1235): reset_l
11-26 01:28:33.874: I/AwesomePlayer(1235): reset_l
11-26 01:28:33.882: I/AwesomePlayer(1235): pause_l 1
11-26 01:28:33.882: I/AwesomePlayer(1235): reset_l
11-26 01:28:33.882: I/ExtendFileSource(1235): release pFilename = 0xf9098
11-26 01:28:33.882: I/AwesomePlayer(1235): reset_l
11-26 01:28:33.882: I/AwesomePlayer(1235): reset_l

Hence, in Android2.3, neither one of shutterCallback, rawCallback and jpegCallback would be called after the picture is taken.


After that, in Android2.2, the shutterCallback and rawCallback is called after picture is taken. But neither of them can provide me data(byte stream). As introduced in http://developer.android.com/reference/android/hardware/Camera.html#takePicture(android.hardware.Camera.ShutterCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback)
, the data will be null if there is no raw image callback buffer available or the raw image callback buffer is not large enough to hold the raw image. And I indeed get null data in rawCallback.


Is all this staff caused by hardware incompatibility or the fault of codes?
Please help

  • 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-17T15:41:23+00:00Added an answer on June 17, 2026 at 3:41 pm

    Hopefully you’ve solved your problem by now, but I think the issue you are running into is that you are setting the camera preview to null, and it needs a valid SurfaceView as the preview to turn the flash on (at least on a Galaxy Nexus and some other Samsung devices…)

    Culprit:

     camera.setPreviewDisplay(null);
    

    Possible Solution:

    Add a SurfaceView to your layout and specify it’s size as 1px by 1px. It seems that it has to be at least that big (size of 0 gives a different error). It might work out to have the SurfaceView off screen (scrolled off or RelativeLayout or something)

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

Sidebar

Related Questions

This is a question that I have been pondering for a long time ,
well i have a configuration like this in the components part of my config
I have a question to the following procedure: script/generate scaffold product title:string description:text db:migrate
Note: I've since asked this question again given the updates to Django's user model
My question is about how to design code that works well with object oriented
Well, this is a question about best practise with Android SQL Lite DB's. I
Well, my website can not redirect to https://www.facebook.com/QuaFootSpa from http://quafootspa.com/ I have tried redirection
I have android code that uses a background process to routinely (e.g. hourly) connect
I have a picture box. This picturebox is used for map. Map has elemenst
I have the following matching problem: I have two data.frames, one with an observation

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.