We provide complete mobile and web apps development solutions

Tuesday, October 23, 2012

Camera:

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

implicit intent launches default camera

Intent i=new Intent("android.media.action.IMAGE_CAPTURE");
startActivity(i);
permission in manifest.xml


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


 Button b=(Button)findViewById(R.id.button1);
        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.



















0 coment�rios:

Post a Comment

Online Training

Your Name :
Your Email: (required)
Your Message: (required)

Powered by Blogger.

Recent Posts

Find Us On Facebook

Popular Posts