KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am writing an application that needs pictures taken with the camera. The problem occurs when I try to take an actual picture. Here's the code that is troubling me: final ShutterCallback shutterCallback = new ShutterCallback() { @Override public void onShutter() { Log.d(TAG, "onShutter"); } }; final PictureCallback callback = new PictureCallback() { @Override public void onPictureTaken(byte[] data, Camera camera) { Log.d(TAG, "onPictureTaken - jpeg"); try { //async task for storing the photo new SavePhotoTask(CameraView.this.ctx, data).execute(); } catch (final SavePhotoException e) { //some exceptionhandling } } }; this.camera = Camera.open(); this.camera.setPreviewDisplay(surfaceHolder); final Camera.Parameters parameters = findBestParameters(w, h); this.camera.setParameters(parameters); this.camera.startPreview(); Log.d(TAG, "takePicture now!"); this.camera.takePicture(shutterCallback, null, callback); On the emulator it seems to work out but on my phone (Motorola Defy - android 2.1). The actual problem: on the phone the picturecallback is never happening "onPictureTaken" gets never called. The Shuttercallback is executed but the other is not (and I tried with raw instead of jpeg, same thing). Does anyone know this problem? I just don't see where the difference lies to the emulator right now. I appreciate your help.
Tags (comma-separated)
Save Edits
Cancel