I used the following code to capture an image. Everything works fine when I capture a 2592x1944 image and the image is captured in landscape mode. Now I want to capture a 534x534 image. I changed the values โโof this parameter params.setPictureSize(534, 534); Nothing will change. How can i do this. Thanks in advance.
DgCamActivity.java
public class DgCamActivity extends Activity implements SensorEventListener { private Camera mCamera; private CameraPreview mPreview; private SensorManager sensorManager = null; private int orientation; private ExifInterface exif; private int deviceHeight; private Button ibRetake; private Button ibUse; private Button ibCapture;
CameraPreview.java
public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback { private SurfaceHolder mHolder; private Camera mCamera; public CameraPreview(Context context, Camera camera) { super(context); mCamera = camera;
test.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <RelativeLayout android:id="@+id/camera_preview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" > </RelativeLayout> <RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="41dp" > <Button android:id="@+id/ibCapture" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/relativeLayout1" android:layout_alignLeft="@+id/camera_preview" android:text="Capture" /> <Button android:id="@+id/ibRetake" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_marginLeft="36dp" android:layout_toRightOf="@+id/ibCapture" android:text="ReTake" /> <Button android:id="@+id/ibUse" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_marginRight="38dp" android:text="Save" /> </RelativeLayout> </RelativeLayout>
source share