android camera example

How to open Camera in android example

        private static final int CAMERA_REQUEST = 1888;
     private ImageView imageView;


        this.imageView = (ImageView)this.findViewById(R.id.ImageView1);

        ImageButton photoButton = (ImageButton) this.findViewById(R.id.imageButton1);
        photoButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
                startActivityForResult(cameraIntent, CAMERA_REQUEST);
            }
        });
    }

    protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
        if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) { 
            Bitmap photo = (Bitmap) data.getExtras().get("data");
            imageView.setImageBitmap(photo);
        } 

মন্তব্যসমূহ

এই ব্লগটি থেকে জনপ্রিয় পোস্টগুলি

How to install Apex

How to Lock a folder Useing bat file || how can folder lock in windows 7...