Android SDK provides a full control on Android devices' hardware, so that you can use any component of your device in your applications. Thanks to this feature, you can use your device's camera to obtain live camera preview in your application. So that, you can build your own camera application with additional features.
Basically in a camera application, you need a camera surface and a button to take photos. First we start with getting required permission for Camera component. Also put a control into the activity tag to keep screen in landscape mode.
Then we create a simple layout includes a SurfaceView and a Button.
Now we are ready to build our application to put the camera preview into our SurfaceView and to set the button's behavior for taking photos. Our activity must implement the SurfaceHolder.Callback interface in order to provide a camera preview.
Then we create our Camera, Surface and Button fields which will be initialized when our activity is started.
After this fields we need to declare which actions will be performed when user takes a photo.
Now we can implement the onCreate method of the Activity to initialize our surface and Button.
Then we must provide some methods for our surface to create first preview, change preview, and stop preview.
Now we have a basic camera application which has a camera preview and a button on screen. You can start taking photos with your applications by pressing the button on the screen. Or you can add this method to use your device's built-in "OK" Button (Trackpad for HTC, OK Button for Samsungs etc.) for taking photos.
Enjoy your new camera applications and take good photos :)