Android Camera Setparameters failed class problem analysis summary

Source: Internet
Author: User


log is displayed as:
09-01 18:47:17.348 15656 15675 E androidruntime:fatal exception:camera Handler Thread
09-01 18:47:17.348 15656 15675 E AndroidRuntime:Process:com.android.camera, pid:15656
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, the parameter is set incorrectly.

Key common errors are set in the following two methods of parameters

Camera.parameters Parameters = Mcamera.getparameters ();

Parameters.setpicturesize (1600, 1200);

Parameters.setpreviewsize (W, h);

How to set these two parameter settings?

First we will take a look at the data processing to see if these two methods can pass those parameters in.

list<size> picturesizes = Parameters.getsupportedpicturesizes ();  
int length = Picturesizes.size ();  
for (int i = 0; i < length; i++) { 
&NBSP;LOG.E ("TAG", "supportedpicturesizes:" + picturesizes.get (i). Width + "x" + picturesizes.get (i). height);  
}  

list< size> 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);  
} 

Through the log we can see

05-21 17:43:17.545:e/fffffffffffffffffffff (21262): supportedpicturesizes:640x480
05-21 17:43:17.545:e/fffffffffffffffffffff (21262): supportedpicturesizes:1600x1200
05-21 17:43:17.545:e/fffffffffffffffffffff (21262): supportedpicturesizes:2048x1536
05-21 17:43:17.545:e/fffffffffffffffffffff (21262): supportedpicturesizes:2592x1456
05-21 17:43:17.545:e/fffffffffffffffffffff (21262): supportedpicturesizes:2592x1952
05-21 17:43:17.545:e/fffffffffffffffffffff (21262): supportedpicturesizes:3264x1840
05-21 17:43:17.545:e/fffffffffffffffffffff (21262): supportedpicturesizes:3264x2448
05-21 17:43:17.545:e/fffffffffffffffffffff (21262): supportedpicturesizes:4160x2336
05-21 17:43:17.545:e/fffffffffffffffffffff (21262): supportedpicturesizes:4160x3120
05-21 17:43:17.545:e/fffffffffffffffffffff (21262): supportedpicturesizes:3104x3104


05-21 17:43:17.545:e/fffffffffffffffffffff (21262): supportedpreviewsizes:176x144
05-21 17:43:17.545:e/fffffffffffffffffffff (21262): supportedpreviewsizes:240x160
05-21 17:43:17.545:e/fffffffffffffffffffff (21262): supportedpreviewsizes:352x288
05-21 17:43:17.545:e/fffffffffffffffffffff (21262): supportedpreviewsizes:320x240
05-21 17:43:17.545:e/fffffffffffffffffffff (21262): supportedpreviewsizes:480x320
05-21 17:43:17.550:e/fffffffffffffffffffff (21262): supportedpreviewsizes:640x480
05-21 17:43:17.550:e/fffffffffffffffffffff (21262): supportedpreviewsizes:720x544
05-21 17:43:17.550:e/fffffffffffffffffffff (21262): supportedpreviewsizes:960x544
05-21 17:43:17.550:e/fffffffffffffffffffff (21262): supportedpreviewsizes:960x720
05-21 17:43:17.550:e/fffffffffffffffffffff (21262): supportedpreviewsizes:720x720
05-21 17:43:17.550:e/fffffffffffffffffffff (21262): supportedpreviewsizes:1280x720
05-21 17:43:17.550:e/fffffffffffffffffffff (21262): supportedpreviewsizes:1440x1080
05-21 17:43:17.550:e/fffffffffffffffffffff (21262): supportedpreviewsizes:1920x1080
05-21 17:43:17.550:e/============== (21262): ==w=1920========h=1080 Hide back key My phone corresponds to the resolution

So the parameters inside the two methods must correspond to the above.

05-21 17:47:43.575:e/============== (21262): ==w=1794========h=1080 Display the resolution of the return key

My problem is that using the Glory 6 phone return keys and home are all within the screen causing high resolution to not reach 1920*1080. But the actual only 1794*1080 and lead to error.


Android Camera Setparameters failed class problem analysis summary

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.