Camera Preview Example In Android Programming

This example explains how you can use camera apis and create camera preview in you applications.

Algorithm:

1.) Create a new project by File-> New -> Android Project name it CameraPreviewExample.

2.) Write following permissions into your manifest xml:


3.) Create and write following into res/menu/camera_menu.xml:

 

 

 

4.) Run for output.

Steps:

1.) Create a project named CameraPreviewExample and set the information as stated in the image.

Build Target: Android 4.0
Application Name: CameraPreviewExample
Package Name: com. example. CameraPreviewExample
Activity Name: CameraPreviewExample
Min SDK Version: 14

2.) Open CameraPreviewExample.java file and write following code there:

 

 

 

3.) Compile and build the project.

Output