I'm using the CameraPreview example API demo. I need to add some views (button, etc..) overlaying the SurfaceView.

For this, I'm trying to set their parameters, but they appear all the time on the top-left side of the screen.

This is the onCreate method of the code:

```
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

        btnTakePhoto = new Button(this);
        btnTakePhoto.setBackgroundResource(android.R.drawable.ic_menu_camera);

        /*Set container*/
        mPreview = new Preview(this);
        setContentView(mPreview);

        /*Set button params and add it to the view*/
        RelativeLayout.LayoutParams buttonParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        buttonParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        buttonParams.addRule(RelativeLayout.CENTER_VERTICAL);
        addContentView(btnTakePhoto, buttonParams);

        numberOfCameras = Camera.getNumberOfCameras();

        CameraInfo cameraInfo = new CameraInfo();
        for (int i = 0; i < numberOfCameras; i++) {
            Camera.getCameraInfo(i, cameraInfo);
            if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
                defaultCameraId = i;
            }
        }
    }

```

Have to say that the values here 

```
RelativeLayout.LayoutParams buttonParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

```

are updating well if I change them. What doesn't change is what contains the addRule() method