What values does Camera.Parameters.set("picture-size", ?) take?
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 itsgetSupportedPictureSizes()
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.
精彩评论