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

Leave a Comment:

6 comments
Neji says August 17, 2012

Very nice !!!!!
Thanks

Reply
yagnesh says August 23, 2012

you can download android basic example from following blog
http://androidprogramminstuff.blogspot.in

Reply
nav says November 28, 2012

You have to proyect android the his example ,, for send to my email plisss very good thank

Reply
Dimi says February 10, 2013

Thanks for this tutorial. I needed to figure out how to get the best preview size for my AR browser and this helped me a lot.

Reply
Panikos says September 28, 2013

Hello. Your code works perfect. I have tried using OnFramePreview to save frames on disk but i haven’t managed to do it. Is it possible using this kind of code? (Your code has Viewgroup in it, i used a similar in the past using surface view but that does not work on my new phone). I will appreciate your reply, as i have spend days of trying to accomplish this.

Reply
Android Camera App study. | YOUNG says August 5, 2014

[…] Camera Preview Example in Android […]

Reply
Add Your Reply