This is my first time using a camera. I\'ve read a lot of examples and also the documentation, so I tried to make my own class to take pictures with the front facing camera.
Take a look at this question for info and code how to do it: Taking pictures with camera on Android programmatically
The code you used here is not wrong, but this one works.
If you want to take a pic without the user being shown a preview, take a look at this code: https://github.com/aporter/coursera-android/blob/master/Examples/AudioVideoCamera/src/course/examples/AudioVideo/Camera/AudioVideoCameraActivity.java
You need to get rid of the SurfaceView that shows the user the preview.