Forward Facing Camera

by paul zazzarino » Sun, 08 Nov 2009 22:39:59 GMT

Sponsored Links
 Anyone have any knowledge of Android devices with forward facing cameras which 
are programable ?
[Native code is ok, does not have to be Java]


Other Threads

1. Is it possible to add my app to the Picture Options list(Menu) of the Gallery app.

Hi there, i am new to android and java, and i have searched the web
now for 2 days for a anzswer to my question.

I would like to write a app (activity) to edit a picture from the
gallery, like the rotate and corp functions.
I would like to find a way to add my app to the menu what pops up
(Picture options) when you press and hold
a selected picture or when you press the menu button.

I have read some where that this ois some how posible with
intentfilter in the AndroidManifest.xml

If some one has a clou how this works and maybe has a sample code to
follow would be great.

Best regards


2. In my app.ShutterCallback didn't implemented

public class Preview extends SurfaceView implements
SurfaceHolder.Callback {
        SurfaceHolder mHolder;
        Camera mCamera;

        Preview(Context context) {
                mHolder = getHolder();

            public void surfaceCreated(SurfaceHolder holder) {
                                mCamera =;
                Camera.Parameters parameters=mCamera.getParameters();
            parameters.setPictureSize(420, 320);

                 mCamera.takePicture(shutterCallback, pictureCallback,
                try {
                } catch (IOException e) {


        private PreviewCallback previewCallback = new PreviewCallback() {

                public void onPreviewFrame(byte[] data, Camera camera) {

                        Log.i("Preview", "onPreviewFrame");


        int i = 0;
        private ShutterCallback shutterCallback = new ShutterCallback() {

                public void onShutter() {

                        Log.i("Preview", "onShutter");
                        if (++i > 1) {


        private PictureCallback pictureCallback = new PictureCallback() {

                public void onPictureTaken(byte[] data, Camera camera) {

                        Log.i("Preview", "onPictureTaken");


        private byte[] picData;
        private PictureCallback jpegPictureCallback = new PictureCallback() {

                public void onPictureTaken(byte[] data, Camera camera) {

                        picData = data;
                        Log.i("Preview", "onPictureTaken jpeg");


        public String getPicture() throws IOException {
                mCamera.takePicture(shutterCallback, pictureCallback,
                if (picData == null) {
                        return null;
                int bytelength=picData.length;
                int length=1024;
                 String dataString = new SimpleDateFormat("yyyy-mm-dd
                 dataString=dataString.replaceAll("\\s", "");
                 dataString=dataString.replaceAll(":", "");

                    String pathString="/sdcard/"+dataString+".jpg";

                FileOutputStream fos = null;
                        try {
                                  fos=new FileOutputStream(pathString);
                                   int offset=0;
                                          fos.write(picData, offset, length);
                                  fos.write(picData, offset, bytelength-offset);

                        } catch (Exception e) {

                return pathString;

        public void cancel() {
                mCamera = null;

        public void surfaceDestroyed(SurfaceHolder holder) {
                // Surface will be destroyed when we return, so stop the
                // preview.
                // Because the CameraDevice object is not a shared resource,
                // it's very
                // important to release it when the activity is paused.
                if (mCamera != null) {
                        mCamera = null;

        public void surfaceChanged(SurfaceHolder holder, int format, int w,
int h) {
                // Now that the size is known, set up the camera parameters
                // and begin
                // the preview.
                Camera.Parameters parameters = mCamera.getParameters();
                parameters.setPreviewSize(w, h);


And when  toggle a breakpoint in the private ShutterCallback
shutterCallback = new ShutterCallback(),it hasn't been implemented.
So when I invoke the getPicture outside ,the picture is black and the
pisdata is null.
Why this happen?Where did i do wrong?


3. Android Device not detected on Karmic

4. Use an android phone's GPS from a website

5. Life cycle and Oncreate clarifications

6. How to set title icon on Dialog Theme

7. How to contact device with ADB from Windows NT