in android, we can access camera from app by 2 ways.

implicit intent launches default camera

Intent i=new Intent("");
permission in manifest.xml

<uses-permission android:name="android.permission.CAMERA"/>

 Button b=(Button)findViewById(;
        b.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                // TODO Auto-generated method stub
                 Intent  i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
                    i.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
                    startActivityForResult(i, cameraData);

Other way is creating Camera class

camera class: to access camera hardware
SurfaceView class : dedicate a drawing surface at lowest level of the view as a placeholder to display the camera preview before describing how these are tied together and the layout structure we have to declare.


Popular posts from this blog

What is Android ?