Code example for Button

Methods: setLayoutParamssetOnClickListenersetText

0
         
        mSurfaceView = new SurfaceView(this);
        mSurfaceView.setLayoutParams(surfaceParams);
        root.addView(mSurfaceView);
         
        Button stopButton = new Button(this);
        stopButton.setText("click");
        buttonParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        buttonParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        buttonParams.rightMargin = 5;
        buttonParams.topMargin = 5;
         
        stopButton.setLayoutParams(buttonParams);
        root.addView(stopButton);
         
        setContentView(root);
         
        mSurfaceHolder = mSurfaceView.getHolder();
        mSurfaceHolder.addCallback(this);
        mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);                    
        mIntent = this.getIntent();
         
        quality = mIntent.getIntExtra("quality", 100);
         
         
        stopButton.setOnClickListener(mSnapListener);
    } 
     
    private OnClickListener mSnapListener = new OnClickListener() {
        public void onClick(View v) { 
        	mCamera.takePicture(null, null, mPictureCallback); 
Contextual code suggestions in your IDE  Get Codota for Java