Android: setPictureFormat() error

I'm a beginner in Andoird, currently trying to write an application using the Camera class of Android in Eclipse. The problem is when I call the parameters.setPictureFormat() method with ImageFormat.JPEG as the argument, I get an error.

Here's how my code looks like:

  public void surfaceChanged(SurfaceHolder holder, int format, int w, int h){
   Camera.Parameters parameters = mCamera.getParameters();

   parameters.setPreviewSize(854,480);  // (h,w)
   parameters.set("jpeg-quality", 100);
   parameters.set("orientation", "lanscape");
   parameters.set("rotation", 90);

And I get this error in return:

ImageFormat cannot be resolved to a variable

I've tried using PixelFormat.JPEG as well, but I get the same error that says "PixelFormat cannot be resolved to a variable". I've checked, it's not importing android.R. I also tried importing but it doesn't work.

Could anybody help point out what the problem is?


For what target are you trying to build this app? is only available for android 2.2. I suppose your selected target is android 2.0 or below.

Two important points:

  • For Android 1.5 and Android 1.6, you can't call setPictureFormat. Only getPictureFormat is supported.
  • For Android 2.0 you will need to call getSupportedPictureFormat to get the list of formats supported.

Need Your Help

Show value based on selection in combo box vba

vba ms-access text combobox

I need to show denominations based on selection in combo box in my access form.

On defining a test Factory that will run a single browser test on the various browsers

selenium selenium-webdriver testng saucelabs

I am trying to concept out how to implement a Factory to test a test class on all browsers that I have defined. Is there a better way to do this. Can anyone suggest a basic improvement?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.