Analysis and Summary of android camera setParameters failed Problems

Source: Internet
Author: User

Analysis and Summary of android camera setParameters failed Problems

 

LOG:
09-01 18:47:17. 348 15656 15675 E AndroidRuntime: fatal exception: Camera Handler Thread
09-01 18:47:17. 348 15656 E AndroidRuntime: Process: com. android. camera, PID: 15675
09-01 18:47:17. 348 15656 15675 E AndroidRuntime: java. lang. RuntimeException: setParameters failed
09-01 18:47:17. 348 15656 15675 E AndroidRuntime: at android. hardware. Camera. native_setParameters (Native Method)

In this case, all parameters are set incorrectly.

The main common errors are the parameter settings of the following two methods:

Camera. Parameters parameters = mCamera. getParameters ();

Parameters. setPictureSize (1600,120 0 );

Parameters. setPreviewSize (w, h );

How can we set these two parameters?

First, let's take a look at the data acquisition and processing to see if these two methods can pass in those parameters.

List PictureSizes = parameters. getSupportedPictureSizes ();
Int length = pictureSizes. size ();
For (int I = 0; I <length; I ++ ){
Log. e ("TAG", "SupportedPictureSizes:" + pictureSizes. get (I). width + "x" + pictureSizes. get (I). height );
}

List PreviewSizes = parameters. getSupportedPreviewSizes ();
Length = previewSizes. size ();
For (int I = 0; I <length; I ++ ){
Log. e ("TAG", "SupportedPreviewSizes:" + previewSizes. get (I). width + "x" + previewSizes. get (I). height );
}

We can see through the log

05-21 17:43:17. 545: E/fffffffffffffffffff (21262): SupportedPictureSizes: 640x480
05-21 17:43:17. 545: E/fffffffffffffffffff (21262): SupportedPictureSizes: 1600x1200
05-21 17:43:17. 545: E/fffffffffffffffffff (21262): SupportedPictureSizes: 2048x1536
05-21 17:43:17. 545: E/fffffffffffffffffff (21262): SupportedPictureSizes: 2592x1456
05-21 17:43:17. 545: E/fffffffffffffffffff (21262): SupportedPictureSizes: 2592x1952
05-21 17:43:17. 545: E/fffffffffffffffffff (21262): SupportedPictureSizes: 3264x1840
05-21 17:43:17. 545: E/fffffffffffffffffff (21262): SupportedPictureSizes: 3264x2448
05-21 17:43:17. 545: E/fffffffffffffffffff (21262): SupportedPictureSizes: 4160x2336
05-21 17:43:17. 545: E/fffffffffffffffffff (21262): SupportedPictureSizes: 4160x3120
05-21 17:43:17. 545: E/fffffffffffffffffff (21262): SupportedPictureSizes: 3104x3104


05-21 17:43:17. 545: E/fffffffffffffffffff (21262): SupportedPreviewSizes: 176x144
05-21 17:43:17. 545: E/fffffffffffffffffff (21262): SupportedPreviewSizes: 240x160
05-21 17:43:17. 545: E/fffffffffffffffffff (21262): SupportedPreviewSizes: 352x288
05-21 17:43:17. 545: E/fffffffffffffffffff (21262): SupportedPreviewSizes: 320x240
05-21 17:43:17. 545: E/fffffffffffffffffff (21262): SupportedPreviewSizes: 480x320
05-21 17:43:17. 550: E/fffffffffffffffffff (21262): SupportedPreviewSizes: 640x480
05-21 17:43:17. 550: E/fffffffffffffffffff (21262): SupportedPreviewSizes: 720x544
05-21 17:43:17. 550: E/fffffffffffffffffff (21262): SupportedPreviewSizes: 960x544
05-21 17:43:17. 550: E/fffffffffffffffffff (21262): SupportedPreviewSizes: 960x720
05-21 17:43:17. 550: E/fffffffffffffffffff (21262): SupportedPreviewSizes: 720x720
05-21 17:43:17. 550: E/fffffffffffffffffff (21262): SupportedPreviewSizes: 1280x720
05-21 17:43:17. 550: E/fffffffffffffffffff (21262): SupportedPreviewSizes: 1440x1080
05-21 17:43:17. 550: E/fffffffffffffffffff (21262): SupportedPreviewSizes: 1920x1080
17:43:17 05-21. 550: E/= (21262 ): ==w = 1920 ========= h = 1080 hide the resolution corresponding to the Return key of my mobile phone

Therefore, the parameters in these two methods must correspond to the above.

17:47:43 05-21. 575: E/= (21262 ): ==w = 1794 ========= h = 1080 display the resolution of the Return key

My problem is that the use of the glory 6 mobile return key and home are both in the screen, resulting in a high resolution of less than 1920*1080. The error is actually caused by 1794*1080.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.