开发者

What values does Camera.Parameters.set("picture-size", ?) take?

开发者 https://www.devze.com 2022-12-23 13:52 出处:网络
my app involves some work with the camera, therefore it needs to handle capturing of images with different resolution. My targets are 1.6 - onwards. Does anyone know what to pass in the value argument

my app involves some work with the camera, therefore it needs to handle capturing of images with different resolution. My targets are 1.6 - onwards. Does anyone know what to pass in the value argument for

Camera.Parameters.set("picture-size", value)

I have look at the Donut release of the Camera app, however, it was not very clear what exactly has been used there as the value is retrieved from the SharedPreferences.

// Set picture size parameter. String pictureSize = mPreferences.getString(CameraSettings.KEY_PICTURE_SIZE, getString(R.string.pref_camera_picturesize_default)); mParameters.set(PARM_PICTURE_SIZE, pictureSize);

Lookin at the strings.xml I can see that R.string.pref_camera_picturesize_default = 2048x1536, however, I'm not sure what other values can be passed there? Is it any resolution yo开发者_C百科u fancy, or are they only certain resolutions the drivers can handle? Thanks.


Well, the way I'd handle it is two-fold:

  • For Android 2.0 (API 5) and newer, use Camera.Parameters and its getSupportedPictureSizes() method to find out what the available options are for the hardware you're running on
  • For Android 1.6, I'd just leave the size alone

I'd use reflection or conditional class loading to have a single code base that supported both paths, choosing the right one for the device it ran on.

0

精彩评论

暂无评论...
验证码 换一张
取 消